Question: #include #include int InputYear(); int Occurence(); int dayofweek(); int new_years(int); int dayspassed(int,int ,int); void results(int,int,int*,int ,int); int date(int *); int main() { int day_of_week=dayofweek(); int

#include #include int InputYear(); int Occurence(); int dayofweek(); int new_years(int); int dayspassed(int,int ,int); void results(int,int,int*,int ,int); int date(int *); int main() { int day_of_week=dayofweek(); int year=InputYear(); int occurence=Occurence(); int Jan1=new_years(year); int n; n=dayspassed(occurence,day_of_week,Jan1); int *days_passed; *days_passed=n; int month=date(days_passed); results(occurence,year,days_passed,month,day_of_week); return 0; } int InputYear() { int Year; printf("Enter year number ->"); scanf("%d",&Year); return Year; } int Occurence() { int occurence; printf("Enter occurence number ->"); scanf("%d",&occurence); return occurence; } int dayofweek() { int day_of_week; printf("Enter day of week number ->"); scanf("%d",&day_of_week); return day_of_week; } int LeapYear(int year) { int c=year%4; return c; } int new_years(int year) { int weekday; weekday=(((year-1)*365+((year-1)/4)-((year-1)/100)-(((year-1)/400)))%7)+1; return weekday; } int dayspassed(int occurence,int day_of_week,int new_years) { int daysPassed; daysPassed=(7*occurence)-(6-abs(day_of_week-new_years)); return daysPassed; } int date(int *days_passed) { int month=0; if(*days_passed>31) //jan { month++; *days_passed-=31; } if(*days_passed>28) //feb { month++; *days_passed-=28; } if(*days_passed>31)//march { month++; *days_passed-=31; } if(*days_passed>30) //april { month++; *days_passed-=30; } if(*days_passed>31) //may { month++; *days_passed-=31; } if(*days_passed>30) //june { month++; *days_passed-=30; } if(*days_passed>31) //july { month++; *days_passed-=31; } if(*days_passed>31) //august { month++; *days_passed-=31; } if(*days_passed>30)//sept { month++; *days_passed-=30; } if(*days_passed>31)//oct { month++; *days_passed-=31; } if(*days_passed>30)//nov { month++; *days_passed-=30; } if(*days_passed>31) //dec { month++; *days_passed-=31; } return month; } void results(int occurence,int year,int *days_passed,int month,int day_of_week) { if(month==1) { printf("Desired occured #%d of %d in %d:January %p",occurence,day_of_week,year,days_passed); } if(month==2) { printf("Desired occured #%d of %d in %d:February %p",occurence,day_of_week,year,days_passed); } if(month==3) { printf("Desired occured #%d of %d in %d:March %p",occurence,day_of_week,year,days_passed); } if(month==4) { printf("Desired occured #%d of %d in %d:April %p",occurence,day_of_week,year,days_passed); } if(month==5) { printf("Desired occured #%d of %d in %d:May %p",occurence,day_of_week,year,days_passed); } if(month==6) { printf("Desired occured #%d of %d in %d:June %p",occurence,day_of_week,year,days_passed); } if(month==7) { printf("Desired occured #%d of %d in %d:July%p",occurence,day_of_week,year,days_passed); } if(month==8) { printf("Desired occured #%d of %d in %d:August %p",occurence,day_of_week,year,days_passed); } if(month==9) { printf("Desired occured #%d of %d in %d:September %p",occurence,day_of_week,year,days_passed); } if(month==10) { printf("Desired occured #%d of %d in %d:October %p",occurence,day_of_week,year,days_passed); } if(month==11) { printf("Desired occured #%d of %d in %d:November %p",occurence,day_of_week,year,days_passed); } if(month==12) { printf("Desired occured #%d of %d in %d:December %p",occurence,day_of_week,year,days_passed); } }

This is the code I have for a program but I am getting an error after putting in the input saying segmentation fault pls I need help quickly.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!