EasyManuals Logo
Home>Casio>Desktop>Z-1

Casio Z-1 User Manual

Casio Z-1
126 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #114 background imageLoading...
Page #114 background image
114
while()
PURPOSE: Executes repeatedly a statement as long as the specified condition is
true (not zero). .
FORMAT: while (condition) statement
PARAMETERS:
Condition can be any variable or expression that will be considered true if not 0.
EXPLANATION:
1. The “while” loop first executes the condition. If the condition is met (true,
returning a value other than 0), the statement is executed, and execution
loops back to the “while” loop to evaluate the condition again.
2. Whenever the condition is not met (false, returning 0), execution of the “while”
loop is ended.
SAMPLE PROGRAM:
/* While example */
/* #include <stdio.h> */
main(){
char ch=’0’;
while (ch<=’Z’){
printf(“Char(%c) = Hex(0x%x)¥n“,ch,ch);
getchar(); /* waits for return key */
ch++;
}
}
SEE: do while(), for(), break, continue
do while()
PURPOSE: Executes statement and carries on repeatedly as long as the specified
condition is true (not zero). .
FORMAT: do statement while (condition);
PARAMETERS:
Condition can be any variable or expression that will be considered true if not 0.
EXPLANATION:
1. The “do” loop first executes the statement.
2. If the condition is met (true, returning a value other than 0), execution loops
back to the “do” loop to execute the statement again.
3. Whenever the condition is not met (false, returning 0), execution of the “do”
loop is ended.
SAMPLE PROGRAM:
/* Do While example */
/* #include <stdio.h> */
main(){
int gcm,x=56,y=63;
printf(“¥nGCM(%d,%d) = ”,x,y);
do{
gcm=x; x=y%x; y=gcm;
}while (x!=0)
printf(“%d¥n”,gcm);
}

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Casio Z-1 and is the answer not in the manual?

Casio Z-1 Specifications

General IconGeneral
BrandCasio
ModelZ-1
CategoryDesktop
LanguageEnglish

Related product manuals