GU.Structure.10 Define a structure with tag population with fields Men and Women. Create structure with in structure using state and population structure. Read and display the data.

//Program Prepared by Chirag Jadav, FYBCA-2018-19

Define a structure with tag population with fields Men and Women. Create structure with in structure using state and population structure. Read and display the data.

#include<stdio.h>
#include<conio.h>

struct population
{
int men;
int women;
};

struct state
{
char name[99];
int total;//for population
struct population gender;
}s1;


void main()
{
clrscr();

printf("\nEnter state name : ");
scanf("%s",s1.name);

printf("\nEnter Total Population : ");
scanf("%d",&s1.total);

printf("\n\tHow may men : ");
scanf("%d",&s1.gender.men);

printf("\n\tHow many women : ");
scanf("%d",&s1.gender.women);

printf("\n-------------------------------");
printf("\nState name : %s",s1.name);

printf("\nTotal Population : %d",s1.total);

printf("\n\tMen : %d",s1.gender.men);

printf("\n\tWomen : %d",s1.gender.women);

getch();
}

No comments:

Post a Comment