Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- struct studentinfo_struct
- {
- char name[20];
- int id;
- float cgpa;
- int phoneNumber;
- };
- int main()
- {
- struct studentinfo_struct std[100] = {0};
- int i, n;
- printf("How many Student's info do want to take?\n");
- scanf("%d", &n);
- for (i = 1; i <= n; i++)
- {
- printf("Enter Student's Name:\t\t");
- scanf(" %s", std[i].name);
- printf("Enter Student's ID no:\t\t");
- scanf("%d", &std[i].id);
- printf("Enter Student's CGPA:\t\t");
- scanf("%f", &std[i].cgpa);
- printf("Enter Student's Phone Number:\t");
- scanf("%d", &std[i].phoneNumber);
- }
- printf("Name:%s\n", std[i].name);
- printf("ID:%d\n", std[i].id);
- printf("CGPA:%f\n", std[i].cgpa);
- printf("PhoneNumber:%d\n", std[i].phoneNumber);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement