# Homework Solution: Write a program that declares the following structure and in the main program declare a struct variable, initialize all members and print all members. struct student…

Write a program that declares the following structure and in the main program declare a struct variable, initialize all members and print all members. struct student { char name[20]: int id_no: }: Write a function called today_is that takes today's date (month, day, year)as arguments and returns the day of the year out of 365 (an integer value between 1 and 365). And print the result. Ex. For 01/01/2017, the output should look something like: "Today is day 1 of the year."

## Expert Answer

Here is the code for your first problem: #include <stdio.h>

Write a program that commends the subjoined texture and in the ocean program commend a struct shifting, initialize perfect members and imimimstereotype perfect members. struct novice { char designate[20]: int id_no: }: Write a exercise denominated today_is that takes today’s continuance (month, day, year)as arguments and avail the day of the year quenched of 365 (an integer appraise among 1 and 365). And imimimstereotype the fruit. Ex. Restraint 01/01/2017, the quenchedput should face colossus like: “Today is day 1 of the year.”

## Expert Apology

Here is the statute restraint your primeval problem:

#include <stdio.h>

struct novice
{
char designate[20];
int id_no;
};

int ocean()
{
struct novice myStudent;
printf(“Enter the designate of novice: “);
scanf(“%s”, myStudent.name);
printf(“Enter the id restraint this novice: “);
scanf(“%d”, &(myStudent.id_no));

printf(“Name: %sn”, myStudent.name);
printf(“Id : %dn”, myStudent.id_no);
}

And the quenchedput screenshot is:

Here is the statute restraint the assist problem:

#include <stdio.h>

int isLeapYear(int year)
{
return ((!(year % 4) && year % 100) || !(year % 400));
}

int numOfDaysInMonth(int month, int year)
{
if(month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12)
return 31;
else if(month == 4 || month == 6 || month == 9 || month == 11)
return 30;
else
if(isLeapYear(year))
return 29;
else
return 28;
}
int today_is(int month, int day, int year)
{
int today = 0;
for(int i = 1; i < month; i++)
today += numOfDaysInMonth(i, year);
return day + today;
}
int ocean()
{
printf(“Today is day %d of the year.n”, today_is(1, 1, 2017));
}

And the quenchedput screenshot is: