Virajsinh

B_PRM_05

Oct 9th, 2017
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.86 KB | None | 0 0
  1. /* Write a program to read and display the information of
  2. all the students in the class. */
  3.  
  4. #include<stdio.h>
  5. #include<conio.h>
  6.  
  7. typedef struct student
  8. {
  9.     int roll, fees;
  10.     char name[80], dob[80];
  11. }stud;
  12.  
  13. void main()
  14. {
  15.     stud info[50];
  16.     int n,i;
  17.     clrscr();
  18.  
  19.     prinf(" Array Of Strucuture");
  20.  
  21.     printf("\n Enter Num : ");
  22.     scanf("%d",&n);
  23.  
  24.     for (i=0; i<n; i++)
  25.     {
  26.         printf("\n Enter Roll : ");
  27.         scanf("%d",&info[i].roll);
  28.  
  29.         printf(" Enter Name : ");
  30.         fflush(stdin);
  31.         scanf("%s",info[i].name);
  32.  
  33.         printf(" Enter Fees : ");
  34.         scanf("%d",&info[i].fees);
  35.  
  36.         printf(" Enter Date Of Birth : ");
  37.         scanf("%s",info[i].dob);
  38.  
  39.     }
  40.  
  41.     for (i=0; i<n; i++)
  42.     {
  43.         printf("\n Roll Num : %d",info[i].roll);
  44.         printf("\n Name : %s",info[i].name);
  45.         printf("\n Fees : %d",info[i].fees);
  46.         printf("\n Date Of Birth : %s\n",info[i].dob);
  47.     }
  48.  
  49.     getch();
  50. }
Add Comment
Please, Sign In to add comment