#include<stdio.h>
#include<conio.h>
struct student
{
char name[20];
int rollno;
float marks[5]; /*for 5 subjects*/
}s1;
void main()
{
//struct student s1;
int i;
printf("Enter name: ");
gets(s1.name);
printf("Enter roll number: ");
scanf("%d",&s1.rollno);
printf("Enter marks for 5 subjects:\n");
for(i=0;i<5;i++)
scanf("%f",&s1.marks[i]);
printf("\nName is %s",s1.name);
printf("\nRoll No. is %d",s1.rollno);
for(i=0;i<5;i++)
printf("\nMark of SUBJECT %d is %0.1f",i+1,s1.marks[i]);
getch();
}
OUTPUT:
No comments:
Post a Comment