Jump to content



Photo
- - - - -

Infinite Loop & Variables


  • Please log in to reply
3 replies to this topic

#1 WildDisease

WildDisease

    Newbie

  • Members
  • Pip
  • 3 posts

  • Calculators:
    Casio fx-9750G PLUS

Posted 15 November 2008 - 11:40 PM

So to make a very iterative process go faster with less effort,
I decided to attempt to develop an application for my Casio fx-9750 PLUS to perform geometric averging.

My code is as follows:

"How many data"?->N
M->1
While C != N
"Enter your data"?->D
D=D/100
M=M*(1+D)
C=C=1
WhileEnd
"Geometric Average:"
M^(1/N),


That is my code that I developed. The problem lies in the "infinite" loop no matter what entry N inputted to be. Also, when I tried to debug and display M and the C calculations within the While Loop, I found out that the values never change which means the only reason it's infinite is because of this.

Could someone please help me??
No tutorial or manual has anything similar than the assignment of variables that I've done.. so something is off..

Edited by WildDisease, 15 November 2008 - 11:47 PM.


#2 IbmPad

IbmPad

    Casio Fan

  • Members
  • PipPip
  • 35 posts
  • Location:France
  • Interests:- Programming (PC and Calc)<br />- Old calculators<br />- Piano<br />- Foreign languages

  • Calculators:
    CP-330 / FX-9860G SD / HP-49G+ / HP-48G / AFX 2.0+ / FX-795P / FX-4500P / FX-8500G/ FX-4000P / FX-602P / FX-7000G / FX-6800G / FX-702P / PB-700 / Sharp PC-1403 / Электроника МК-61 / TI-57 II / FX-180PV / FX-82 / FX-82D / FX-92

Posted 16 November 2008 - 08:22 AM

I have not tested but there are syntax mistakes : to assign a value to a variable, it must be : value→variable.

Your code must be :

"How many data"?→N
M→1
While C ≠ N
"Enter your data"?→D
D÷100→D
M×(1+D)→M
C+1→C
WhileEnd
"Geometric Average:"
M^(1/N),

Edited by IbmPad, 16 November 2008 - 08:23 AM.


#3 WildDisease

WildDisease

    Newbie

  • Members
  • Pip
  • 3 posts

  • Calculators:
    Casio fx-9750G PLUS

Posted 16 November 2008 - 05:18 PM

I followed that code but still seemed to get Syntax Error..
I even switched around the assigning from A+1->B to B->A+1

But nothing.. It asks for how much data, after that input, syntax error.

#4 WildDisease

WildDisease

    Newbie

  • Members
  • Pip
  • 3 posts

  • Calculators:
    Casio fx-9750G PLUS

Posted 16 November 2008 - 05:25 PM

Oh beautiful!
Never mind!

I got it working following your instructions just broke some code down even further, works like a charm!


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users