#include <stdio.h>
void main()
{
struct state{
char name[20];
int eng,med,mgmt,uni,total;
}state[3];
int a;
clrscr();
printf("\nState Details\n-------------\n");
for(a=0;a<3;a++)
{
printf("\nState %d-\nName : ",a+1);
flushall(); gets(state[a].name);
printf("Engg. Colleges : ");
flushall(); scanf("%d",&state[a].eng);
printf("Medical Colleges : ");
flushall(); scanf("%d",&state[a].med);
printf("Management Collegs : ");
flushall(); scanf("%d",&state[a].mgmt);
printf("INT. Universities : ");
flushall(); scanf("%d",&state[a].uni);
state[a].total=state[a].eng+state[a].med+state[a].mgmt+state[a].uni;
}
clrscr();
printf("\nState Details\n-------------\n");
for(a=0;a<3;a++)
{
printf("\nState %d\t\t\t : %s",a+1,state[a].name);
printf("\nEngg. Colleges\t\t : %d",state[a].eng);
printf("\nMedical Colleges\t : %d",state[a].med);
printf("\nManagement Collegs\t : %d",state[a].mgmt);
printf("\nINT. Universities\t : %d",state[a].uni);
printf("\nTotal Colleges\t\t : %d\n",state[a].total);
}
if(state[0].total>state[1].total && state[0].total>state[2].total)
printf("\nHighest No. of colleges\t : %s",state[0].name);
else if(state[1].total>state[0].total && state[1].total>state[2].total)
printf("\nHighest No. of colleges\t : %s",state[1].name);
else
printf("\nHighest No. of colleges\t : %s",state[2].name);
getch();
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.