Sunday 11 December 2011

Write a program to print the name, roll no, and date of brith in c

#include
#include
struct date
{
int dd,mm,yy;
clrscr();
};
struct student
{
int roll;
char name[20];
struct date dob;
};
void main()
{
struct student p;
clrscr();
printf("Enter name");
gets(p.name);
printf("Enter roll no.");
scanf("%d",&p.roll);
printf("Enter dd/mm/yy");
scanf("%d%d%d",&p.dob.dd,&p.dob.mm,&p.dob.yy);
printf("\nName is %s",p.name);
printf("\nRoll No. is%d",p.roll);
printf("\nDOB is %d/%d/%d",p.dob.dd,p.dob.mm,p.dob.yy);
getch();
}

OUTPUT
Enter name :mahesh
Enter roll no. 23

Enter dd/mm/yy. 02/21/87

Name is mahesh
Roll No. is 23

DOB 02/21/87

No comments:

Post a Comment