Guest User

Untitled

a guest
Jan 21st, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. /*Write a program which reads three integer values representing a date as day, month, year. Assuming that only valid values are input
  2. print out the number day, month and year for the following day's date.
  3. Sample Input: 28 2 1992
  4. Sample output: Date following 28 2 1992 is 29 2 1992
  5.  
  6. Assume every month has 30 days in it.
  7. */
  8.  
  9. #include <stdio.h>
  10.  
  11. int main(){
  12.  
  13. int day,month,year;
  14.  
  15. printf("please enter the day date\n");
  16. scanf("%d",&day);
  17.  
  18. printf("please enter the months numberical value\n");
  19. scanf("%d",&month);
  20.  
  21. printf("Please enter the year\n");
  22. scanf("%d",&year);
  23.  
  24. if(++day<=30){
  25. printf("tomorrows date is %d\\%d\\%d\n",day,month,year);
  26. }
  27.  
  28. if(++day>30 && month<12){
  29. day=1;
  30. month++;
  31. printf("tomorrows date is %d\\%d\\%d\n",day,month,year);
  32. }
  33.  
  34. if(++day>30 && month==12){
  35. day=1;
  36. month=1;
  37. year++;
  38. printf("tomorrows date is %d\\%d\\%d\n",day,month,year);
  39. }
  40.  
  41. system("pause");
  42. }
Add Comment
Please, Sign In to add comment