Advertisement
Lisaveta777

Prata Chapter 5 exs 9

Aug 4th, 2018
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.36 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4.  
  5. {
  6.     float f;
  7.     int counter = 0; //just to break cycle, that became endless, once 'q' is entered
  8.     scanf("%f",&f);
  9.  
  10.     while( f!= (float)'q')//that's where problem is!
  11.     {
  12.         printf("f is %f\n",f);
  13.         scanf("%f",&f);
  14.         counter++;
  15.         if(counter==5)
  16.             break;
  17.  
  18.     }
  19.  
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement