***In C programming. Program must use user defined functions and rely only on if
ID: 3675073 • Letter: #
Question
***In C programming. Program must use user defined functions and rely only on if, else, and else if. No "for" or repetition functions. Thank you in advance!! ***
Problem: In recent years the start of spring break has taken place 9 weeks after the start of the spring semester. Given a month, day, and year determine the date that occurs 9 weeks later.
Example Execution #1 (this school year): Enter month number: 1 Enter day number: 11 Enter the year: 2016 Original Date: 1/11/2016 Future Date: 3/14/2016
Example Execution #2 (next school year): Enter month number: 1 Enter day number: 9 Enter the year: 2017 Original Date: 1/9/2017 Future Date: 3/13/2017
Example Execution #3 (dates can span years): Enter month number: 12 Enter day number: 31 Enter the year: 2015 Original Date: 12/31/2015 Future Date: 3/3/2016
Example Execution #4: Enter month number: 10 Enter day number: 30 Enter the year: 2014 Original Date: 10/30/2014 Future Date: 1/1/2015
Explanation / Answer
#include<stdio.h>
void main()
{
int m,d,y;
printf("Enter month number: ");
scanf("%d",&m);
printf("Enter day number: ");
scanf("%d",&d);
printf("Enter year number: ");
scanf("%d",&y);
printf("Original Date: %d/%d/%d",m,d,y);
printf(" Future Date: %d/%d/%d",(m+2),(d+3),y);
system("pause");
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.