Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

N Student #433

Open
bca072024 opened this issue Jul 12, 2024 · 0 comments
Open

N Student #433

bca072024 opened this issue Jul 12, 2024 · 0 comments

Comments

@bca072024
Copy link

Write a c program to input n student details & display the output
#include<stdio.h>
#include<conio.h>
struct student
{
char student_name[25],stream[5];
int roll_no,m1,m2,m3,m4,total;
float avg;
};
void main()
{
int n,i;
printf("Enter Number of student:");
scanf("%d",&n);
struct student stud[n];
printf("Enter student Details");
for (i=0;i<n;i++)
{
fflush(stdin);
printf("\nEnter student name:");
gets(stud[i].student_name);
printf("\nEnter Roll no:");
scanf("%d",&stud[i].roll_no);
fflush(stdin);
printf("\nEnter stream:");
gets(stud[i].stream);
printf("\nEnter Marks in 4 subject:");
scanf("%d %d %d %d",&stud[i].m1,&stud[i].m2,&stud[i].m3,&stud[i].m4);
stud[i].total=stud[i].m1+stud[i].m2+stud[i].m3+stud[i].m4;
stud[i].avg=stud[i].total/4;
}
printf("\n STUDENT NAME ROLL NO STRAEM SUB1 SUB2 SUB3 SUB4 TOTAL AVG\n");
for (i=0;i<n;i++)
{
printf("\n %s %d %s %d %d %d %d %d
%.2f",stud[i].student_name,stud[i].roll_no,stud[i].stream,stud[i].m1,stud[i].m2,stud[i].m3,stud[i].m4,stu
d[i].total,stud[i].avg);
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant