Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Write a program which reads three integer values representing a date as day, month, year. Assuming that only valid values are input
- print out the number day, month and year for the following day's date.
- Sample Input: 28 2 1992
- Sample output: Date following 28 2 1992 is 29 2 1992
- Assume every month has 30 days in it.
- */
- #include <stdio.h>
- int main(){
- int day,month,year;
- printf("please enter the day date\n");
- scanf("%d",&day);
- printf("please enter the months numberical value\n");
- scanf("%d",&month);
- printf("Please enter the year\n");
- scanf("%d",&year);
- if(++day<=30){
- printf("tomorrows date is %d\\%d\\%d\n",day,month,year);
- }
- if(++day>30 && month<12){
- day=1;
- month++;
- printf("tomorrows date is %d\\%d\\%d\n",day,month,year);
- }
- if(++day>30 && month==12){
- day=1;
- month=1;
- year++;
- printf("tomorrows date is %d\\%d\\%d\n",day,month,year);
- }
- system("pause");
- }
Add Comment
Please, Sign In to add comment