Thursday, February 17, 2011

write a program using nested structure in c.


#include<conio.h>
#include<stdio.h>
 struct stud
{
char name[25];
int roll;
int marks;
struct DOB
{
int day;
int month;
int year;
}d;
}s1;
void main()
{
  int i;
  clrscr();
  struct stud s1,s2,s3;
  printf("\n Enter your name\t\t:\t");
  scanf("%s",&s1.name);
  printf("\n Enter your Roll No\t\t:\t");
  scanf("%d",&s1.roll);
  printf("\n Enter your 5 subject marks\t:\t");
  scanf("%d",&s1.marks);
  printf("\n Enter your day of birth\t:\t");
  scanf("%d",&s1.d.day);
  printf("\n Enter your month of birth\t:\t");
  scanf("%d",&s1.d.month);
  printf("\n Enter your year of birth\t:\t");
  scanf("%d",&s1.d.year);
  clrscr();
  printf("\n Your Enter Details are");
  printf("\n Nmae \t Roll No\t Marks\t DOB");
  printf("\n %s\t %d\t\t %d \t %d-%d-%d\t\b",s1.name,s1.roll,s1.marks,s1.d.day,s1.d.month,s1.d.year);


  getch();
  }

No comments:

Post a Comment