fork download
  1.  
  2. # include<stdio.h>
  3.  
  4. int main()
  5. {
  6.  
  7.  
  8. /* variable definition: */
  9.  
  10. float rain, sum;
  11.  
  12. /* Initialize */
  13. sum = 0;
  14.  
  15. // Loop through to input values
  16. for (int count=0; count < 12; count++)
  17. for (int year =0; year <5; year++)
  18.  
  19. {
  20. printf("Enter rainfall for this year\n");
  21.  
  22. scanf("%f", &rain);
  23. if (rain >=0.0 )
  24. if(year<5)
  25.  
  26. {
  27.  
  28. sum +=rain;
  29.  
  30. }
  31. else {
  32. printf("No more rain\n");
  33. }
  34. }
  35.  
  36. printf("sum of rainfall is\n");
  37. scanf ("%f", &rain);
  38.  
  39. return sum;
  40. }
  41.  
Runtime error #stdin #stdout 0s 9416KB
stdin
1.2
2.2
3.3
4.4
5.5
6.6
7.7
8.8
9.9
10.0
11.1
12.2
stdout
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
Enter rainfall for this year
sum of rainfall is