ACP_U1p6.c

#include<stdio.h> #include<conio.h> #include<string.h> struct state { char name[30]; int eng; int med; int manage; int uni; int total; }; void main() { struct state s[5]; int i,max; char st[30]; clrscr(); for(i=0;i<5;i++) { printf("=======state[%d] data=========",i+1); printf("enter state name:"); scanf("%s",&s[i].name); printf("enter total number of engineering colleges:"); scanf("%d",&s[i].eng); printf("enter total number of management colleges:"); scanf("%d",&s[i].manage); printf("enter total number of medical colleges:"); scanf("%d",&s[i].med); printf("enter total number of universities colleges:"); scanf("%d",&s[i].uni); } printf("========total colleges=========="); for(i=0;i<5;i++) { s[i].total=s[i].eng+s[i].med+s[i].manage+s[i].uni; printf("Total number of colleges in %s are %d",s[i].name,s[i].total); } max=s[0].total; for(i=0;i<5;i++) { if(s[i].total); { max=s[i].total; strcpy(st,s[i].name); } } printf("highest number of colleges is in %s and they are %d",st,max); 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.