C program to print date of birth

C program to print date of birth


Output:

Enter your date of birth: dd mm yyyy(ex: 19 may 2015):

19 may 2015
The Date of Birth entered is:
19th may 2015

Implementation:


#include <stdio.h>

struct date
{
 int day;
 char month[20];
 int year;
};

int main(void) {
 struct date d;
 printf("Enter your date of birth: dd mm yyyy(ex: 19 may 2015):\n");
 scanf("%d %s %d",&d.day,d.month,&d.year);
 printf("The Date of Birth entered is:\n");
 printf("%dth %s %d",d.day,d.month,d.year);
 return 0;
}