INPUT IN UNION FOR STUDENT RECORDS

#include<stdio.h>
#include<conio.h>
union student
{
  int rno;
  char name[20];
  int age;
};
union student s1;
void main()
{
 clrscr();
  printf("\n Student Details");
  printf("\n\t Enter roll number ");
  scanf("%d",&s1.rno);
  printf("\nRoll Number=%d",s1.rno);

 printf("\n\t Enter name ");
 scanf("%s",&s1.name);
 printf("\n Name = %s",s1.name);

 printf("\n\t Enter age ");
 scanf("%d",&s1.age);
 printf("\n Age = %d",s1.age);
 getch();

}
Output

No comments:

Post a Comment

Programmingway@Eklavya Technosys!: JTET 2026 | Computer Sections Solutions | Paper -II

Programmingway@Eklavya Technosys!: JTET 2026 | Computer Sections Solutions | Paper -II :   1) Which of the following is the extension of Not...