0% found this document useful (0 votes)
2 views1 page

C Program for Student Data Entry

The document contains a C program that defines a structure for student information, including ID, name, age, and grade. It prompts the user to input data for two students and then displays that information. The program utilizes arrays and loops to handle multiple entries and outputs formatted data.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

C Program for Student Data Entry

The document contains a C program that defines a structure for student information, including ID, name, age, and grade. It prompts the user to input data for two students and then displays that information. The program utilizes arrays and loops to handle multiple entries and outputs formatted data.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

#include <stdio.

h>
#include <string.h>

struct std{
int ID;
char name [26];
int age;
float grade;
}sarr[2];
int main (){
for (int i=0;i<2;i++){
printf("enter student ID\n");
scanf("%d",&sarr[i].ID);
printf("enter student name\n");
scanf("%s",&sarr[i].name);
printf("enter student age\n");
scanf("%d",&sarr[i].age);
printf("enter student grade\n");
scanf("%f",&sarr[i].grade);}
for (int i=0;i<2;i++){
printf("student %d\n",i);
printf("%d\n",sarr[i].ID);
printf("%s\n",sarr[i].name);
printf("%d\n",sarr[i].age);
printf("%.2f\n",sarr[i].grade);
}

return 0;
}

You might also like