Create a structure a type date that contains three members: the day, the month, the year, all of type int. Here the user enter a date in the format 10/9/2007, store it in a variable of type date, then retrieve the value from the variable and print the mouth in the same format.
#include <stdio.h>
struct date
{
int month;
int day;
int year;
};
int main ()
{
struct date D;
printf ("Enter month (in format :10/9/2007) : ");
scanf ("%d/%d/%d", &D.month,&D.day,&D.year);
printf("The Entered Date is : %d/%d/%d",D.month,D.day,D.year);
return 0;
}
Comments
Leave a comment