WRITE A PROGRAM TO CREATE STRUCTURE CLIENT WITH FOLLOWING ATTRIBUTE. CLIENTNO,NAME INVESTMENT_TYPE,INVESTMENT_AMT,DURATION. ACCEPT FIVE DETAILS AND DISPLAY NAME OF CLIENT WHOSE INVESTMENT AMT IS HIGHEST.
#include<stdio.h>
#include<conio.h>
struct client
{
int no,amt,dur;
char name[20],type[20];
};
int main()
{
int i,j,max=0,loc;
struct client c[3];//array of structure
//clrscr();
for(i=0;i<3;i++)
{
printf("\n client no.:");
scanf("%d",&c[i].no);
printf("\n client name:");
scanf("%s",c[i].name);
printf("\n investment type:");
scanf("%s",c[i].type);
printf("\n invetsment amount:");
scanf("%d",&c[i].amt);
printf("\n duration:");
scanf("%d",&c[i].dur);
}
printf("\n--------------Client info--------------");
for(i=0;i<3;i++)
{
printf("\n %d \t %s \t %s \t %d \t %d",c[i].no,c[i].name,c[i].type,c[i].amt,c[i].dur);
}
for(i=0;i<3;i++)
{
if(c[i].amt > max)
{
max=c[i].amt;
loc=i;
}
}
printf("\n Maximum amount is %d",max);
printf("\n %d \t %s \t %s \t %d \t %d",c[loc].no,c[loc].name,c[loc].type,c[loc].amt,c[loc].dur);
return 0;
}
Leave a Reply