|
Description
An example of using
a while loop
Code
/*while example*/
#include<stdio.h>
int main(void)
{
const int SECRET_CODE = 15;
int code;
printf("Type the secret number
to enter.\n");
scanf("%d", &code);
while(code != SECRET_CODE)
{
printf("Type the secret number
to enter.\n");
scanf("%d", &code);
}
printf("Well done , you can now
enter.\n");
return 0;
}
Information
tested using Visual
C++ 6 , LCC Win 32
|