#include<conio.h>
#include<stdio.h>
void main()
{
union student
{
char name[20];
int roll;
float per;
char grade;
}u1;
clrscr();
printf("enter the name\n");
scanf("%s",u1.name);
printf("name->%s\n",u1.name);
printf("enter the roll\n");
scanf("%d",&u1.roll);
printf("roll no->%d\n",u1.roll);
printf("enter the percentage\n");
scanf("%f",&u1.per);
printf("percentage->%f\n",u1.per);
printf("enter the grade\n");
fflush(stdin);
scanf("%c",&u1.grade);
printf("grade->%c",u1.grade);
printf("\nname->%s\n",u1.name);
printf("\nroll no->%d\n",u1.roll);
printf("\npercentage->%f\n",u1.per);
printf("\ngrade->%c",u1.grade);
getch();
}
#include<stdio.h>
void main()
{
union student
{
char name[20];
int roll;
float per;
char grade;
}u1;
clrscr();
printf("enter the name\n");
scanf("%s",u1.name);
printf("name->%s\n",u1.name);
printf("enter the roll\n");
scanf("%d",&u1.roll);
printf("roll no->%d\n",u1.roll);
printf("enter the percentage\n");
scanf("%f",&u1.per);
printf("percentage->%f\n",u1.per);
printf("enter the grade\n");
fflush(stdin);
scanf("%c",&u1.grade);
printf("grade->%c",u1.grade);
printf("\nname->%s\n",u1.name);
printf("\nroll no->%d\n",u1.roll);
printf("\npercentage->%f\n",u1.per);
printf("\ngrade->%c",u1.grade);
getch();
}
No comments:
Post a Comment