fork download
  1. #include <stdio.h>
  2.  
  3.  
  4. int main(){
  5.  
  6. int daysIn_CurrentFebruary = 29;
  7. int daysIn_January = 31;
  8. int daysIn_February = daysIn_CurrentFebruary;
  9. int daysIn_March = 31;
  10. int daysIn_April = 30;
  11. int daysIn_May = 31;
  12. int daysIn_June = 30;
  13. int daysIn_July = 31;
  14. int daysIn_August = 31;
  15. int daysIn_September = 30;
  16. int daysIn_October = 31;
  17. int daysIn_November = 30;
  18. int daysIn_December = 31;
  19.  
  20. int Q1 = daysIn_January + daysIn_February + daysIn_March;
  21. int Q2 = daysIn_April + daysIn_May + daysIn_June;
  22. int Q3 = daysIn_July + daysIn_August + daysIn_September;
  23. int Q4 = daysIn_October + daysIn_November + daysIn_December;
  24.  
  25. printf("Days in Q1 of the current year:%d\n",Q1);
  26. printf("Days in Q1 of the current year:%d\n",Q2);
  27. printf("Days in Q1 of the current year:%d\n",Q3);
  28. printf("Days in Q1 of the current year:%d\n",Q4);
  29.  
  30. return 0;
  31. }
  32.  
  33. /*
  34. Write a program which computes and prints the sum of the days in all four quarters of the current year. Use variables to store these four
  35. values.
  36. If you want, you can use code from a previous task, but you will learn more if you write the code from the beginning.
  37. Example output
  38. Days in Q1 of the current year: 91
  39. Days in Q2 of the current year: 91
  40. Days in Q3 of the current year: 92
  41. Days in Q4 of the current year: 92
  42. Example output
  43. Days in Q1 of the current year: 90
  44. Days in Q2 of the current year: 91
  45. Days in Q3 of the current year: 92
  46. Days in Q4 of the current year: 92
  47. */
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
Days in Q1 of the current year:91
Days in Q1 of the current year:91
Days in Q1 of the current year:92
Days in Q1 of the current year:92