#include<stdio.h>
#include<conio.h>
void main()
{
struct person
{
char name[10];
int age;
}p1,p2;
clrscr();
printf("Enter name and age of Person 1\n");
scanf("%s%d",p1.name,&p1.age);
printf("Enter name and age of Person 2\n");
scanf("%s%d",p2.name,&p2.age);
printf("Person 1 Details\n");
printf("Name=%s\tAge=%d\n",p1.name,p1.age);printf("Person 2 Details\n");
printf("Name=%s\tAge=%d\n",p2.name,p2.age);
getch();
}
OUTPUT:

#include<conio.h>
void main()
{
struct person
{
char name[10];
int age;
}p1,p2;
clrscr();
printf("Enter name and age of Person 1\n");
scanf("%s%d",p1.name,&p1.age);
printf("Enter name and age of Person 2\n");
scanf("%s%d",p2.name,&p2.age);
printf("Person 1 Details\n");
printf("Name=%s\tAge=%d\n",p1.name,p1.age);printf("Person 2 Details\n");
printf("Name=%s\tAge=%d\n",p2.name,p2.age);
getch();
}
OUTPUT:
Enter name and age of Person 1
Tushar
18
Enter name and age of Person 2
Kamal
20
Person 1 Detail's
Name=Tushar Age=18
Person 2 Detail's
Name=Kamal Age=20
No comments:
Post a Comment