WAP to take one union name is student member variable are rollno, name and age. Take input from user and display output.
Defination:: WAP to take one union name is student member variable are rollno, name and age. Take input from user and display output.
Source Code::
union stdent
{
int no;
char na[10];
int age;
}s;
void main()
{
clrscr();
printf("enter rollno,name,age");
scanf("%d",&s.no);
printf("rollno:%d\n",s.no);
scanf("%s",s.na);
printf("name:%s\n",s.na);
scanf("%d",&s.age);
printf("age:%d\n",s.age,);
getch();
}
Source Code::
union stdent
{
int no;
char na[10];
int age;
}s;
void main()
{
clrscr();
printf("enter rollno,name,age");
scanf("%d",&s.no);
printf("rollno:%d\n",s.no);
scanf("%s",s.na);
printf("name:%s\n",s.na);
scanf("%d",&s.age);
printf("age:%d\n",s.age,);
getch();
}
WAP to take one union name is student member variable are rollno, name and age. Take input from user and display output.
Reviewed by Unknown
on
21:30
Rating:
No comments: