donmike25

tut5(2)

Jul 21st, 2013
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4.  
  5. {
  6. float readings[9]={2.5,3.5,0.5,4.6,3.2,0.8,1.2,4.8,3.8};
  7. int i;
  8. int low=0, medium=0, high=0;
  9.  
  10. for(i=0;i<=8;i++)
  11. {
  12.     if(readings[i]>4.0) high++;
  13.         else if(readings[i]>2.0) medium++;
  14.         else low++;}
  15.  
  16. printf("There are %d places recorded low rainfall\n",low);
  17. printf("There are %d places recorded medium rainfall\n",medium);
  18. printf("There are %d places recorded high rainfall\n",high);
  19.  
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment