Advertisement
Noibedya

Untitled

Apr 24th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. struct studentinfo_struct
  4. {
  5.     char name[20];
  6.     int id;
  7.     float cgpa;
  8.     int phoneNumber;   
  9. };
  10. int main()
  11. {
  12.     struct studentinfo_struct std[100] = {0};
  13.  
  14.     int i, n;
  15.     printf("How many Student's info do want to take?\n");
  16.     scanf("%d", &n);
  17.     for (i = 1; i <= n; i++)
  18.     {
  19.         printf("Enter Student's Name:\t\t");
  20.         scanf(" %s", std[i].name);
  21.         printf("Enter Student's ID no:\t\t");
  22.         scanf("%d", &std[i].id);
  23.         printf("Enter Student's CGPA:\t\t");
  24.         scanf("%f", &std[i].cgpa);
  25.         printf("Enter Student's Phone Number:\t");
  26.         scanf("%d", &std[i].phoneNumber);
  27.     }
  28.     printf("Name:%s\n", std[i].name);
  29.     printf("ID:%d\n", std[i].id);
  30.     printf("CGPA:%f\n", std[i].cgpa);
  31.     printf("PhoneNumber:%d\n", std[i].phoneNumber);
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement