Form
while (expression)
statement
The statement portion is repeated until the expression becomes false or zero.
examples
1. while (n++ <100)
printf(" %d %d\n", n, 2*n+1);
2. while(fargo<1000)
{
fargo = fargo + step;
step = 2* step;
}
3 sample program
#include< stdio.h >
#define NUMBER 22
main()
{
int count = 1; // initialization
while(count < = NUMBER) // test
{
printf("Be my Valentine!\n"); // action
count++; // increment count
}
}
0 comments:
Post a Comment