Basic "Structure" Code

//Structure input / Output

#include<stdio.h>
struct stu {
 int h,e,m;
 char na[10];
 int rno;
};typedef struct stu stu;
void main()
{
stu b;
printf("enter the name of student and roll no\n");
scanf("%s%d",b.na,&b.rno);
printf("enter the marks of 3 subjects hindi english and maths\n");
scanf("%d%d%d",&b.h,&b.m,&b.e);
printf("\nName : =%s\nRoll No : =%d\n",b.na,b.rno);
printf("\nMarks of three subjects :\n Hindi : = %d\nEnglish : = %d\nMaths : = %d\n",b.h,b.e,b.m);
}

No comments:

Post a Comment