/*wrote a c program to accept customer details: account_no,name,
balance in account. assume maximum 20 customer in the bank wrote
a function to print the account number & name of each with
balance below RS.100*/
#include<stdio.h>
#include<conio.h>
#include<string.h>
struct customer
{
int accno;
char name[20];
int bal;
};
struct customer cust[3];
void low_bal();
void set_data();
void display();
void main()
{
clrscr();
set_data();
display();
low_bal();
display();
}
void set_data()
{
int i;
for(i=0;i<3;i++)
{
printf("\n\nenter the account number\n\t");
scanf("%d",&cust[i].accno);
printf("\nenetr the name\n\t");
scanf("%s",&cust[i].name);
printf("\nenter the balance\n\t");
scanf("%d",&cust[i].bal);
clrscr();
}
}
void display()
{
int i;
for(i=0;i<3;i++)
{
printf("\n\n\tcustmer number :%d",i+1);
printf("\n\n\taccount number :%d",cust[i].accno);
printf("\n\tname of customer :%s",cust[i].name);
printf("\n\tbalance of customer :%d",cust[i].bal);
}
getch();
}
void low_bal()
{
int j=0,i;
clrscr();
printf("\n\n name & account number \nwhose balance is less tahn 100");
for(i=0;i<3;i++)
{
if(cust[i].bal<100)
{
j=1;
printf("\n\tthe custoer number :%d",j);
printf("\n\t\taccount number of customer :%d",cust[i].accno);
printf("\n\t\tname of customer :%s",cust[i].name);
}
}
if(j==0)
printf("\n\tevery customer has more balance");
getch();
}
/*
name & account number
whose balance is less tahn 100
the custoer number :2
account number of customer :12
name of customer :santosh
the custoer number :3
account number of customer :13
name of customer :sahil
custmer number :1
account number :11
name of customer :peer
balance of customer :200.000000
custmer number :2
account number :12
name of customer :santosh
balance of customer :99.000000
custmer number :3
account number :13
name of customer :sahil
balance of customer :79.000000 */
No comments:
Post a Comment