1 while(number < 6){ 2 printf("Your number is too small.\n"); 3 scanf("%d", &number); 4 } 5 6 7 while(ch != '$'){ 8 count++; 9 scanf("%c", &ch);10 } 11 12 13 while(scanf("%f", &num) == 1){14 sum = sum +num;15 }
1 #include2 #include 3 int main(void){ 4 const double ANSWER = 3.14159; 5 double respone; 6 7 scanf("%lf", &respone); 8 while (fabs(respone - ANSWER) > 0.0001){ 9 printf("Try again.\n");10 scanf("%lf", &respone);11 }12 13 printf("Close enough.\n");14 15 return 0;16 }
REMEBER :
You should limit yourself to using only < and > in floating-point comparisons.
while(status == 1) is ture. and while(status = 1) is ture ....so advice to write like that while(1 == status).