Posts

Showing posts with the label structure in c

Structure Program #2

Image
14. Create array of structure Student_Detail (Enrollment_no, Name, Semester, CPI) for N students, read their i14. Create array of structure Student_Detail (Enrollment_no, Name, Semester, CPI) for N students, read their information and print it. #include <stdio.h> struct student {     char enrollment[100];     char name[100];     int sem;     float cpi; } s[10]; void main() {     int i,n;         printf("Enter the number of student:\n");     scanf("%d",&n);     printf("Enter information of students:\n");     // storing information     for(i=0; i<n; ++i)     {         printf("\nFor number%d,\n",i+1);         printf("Enter enrollment: ");         scanf("%s", s[i].enroll...

Structure Program #1

Image
13. Create structure Student_Detail (Enrollment_no, Name, Semester, CPI). Write a program to read the detail from user and print it. #include <stdio.h> struct student {     char enrollment[100];     char name[100];     int sem;     float cpi; } s; void main() {     printf("Enter information:\n");     printf("Enter enrollment: ");     scanf("%s", s.enrollment);         printf("Enter name: ");     scanf("%s", s.name);     printf("Enter semester: ");     scanf("%d", &s.sem);     printf("Enter CPI: ");     scanf("%f", &s.cpi);     printf("\nDisplaying Information:\n");     printf("Enrollment: ");     puts(s.enrollment);         printf("Name: ");   ...