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. sum +=rain;
  27. printf("sum of rainfall is\n");
  28. scanf ("%f", &rain);
  29. }
  30. else {
  31. printf("No more rain\n");
  32. }
  33.  
  34.  
  35. }
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42. return sum;
  43. }
Runtime error #stdin #stdout 0s 9416KB
stdin
1.2
2.2
3.3
2.2
10.2
12.2
2.3
0.4
0.2
1.1
2.1
0.4
stdout
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is
Enter rainfall for this year
sum of rainfall is