Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Create a structure to specify data of customers in a bank. The data to be sto

ID: 3622736 • Letter: 1

Question

1. Create a structure to specify data of customers in a bank. The data to be stored is:
Account number, Name, Balance in account. Assume maximum of 200 customers in
the bank.
(a)Write a function to print the Account number and name of each customer with balance
below Rs. 100.
(b) If a customer request for withdrawal or deposit, it is given in the form: Acct. no,
amount, code (1 for deposit, 0 for withdrawal)
Write a program to give a message, “The balance is insufficient for the specified
withdrawal”.

program is supposed to be answered in C language not C++ Thanks and regards!

Explanation / Answer

// for a/c nos 3 ,4 and 5 balance is less than 100.

#include<stdio.h>
#include<string.h>
#include<conio.h>          // comment this if u r using linux.
struct bankinfo{
int acno;
char name[30];
int balance;
}data[200];
void printballes100(struct bankinfo d[],int);
int main()

{
int i,p,acno,money;
clrscr();
data[0].acno = 1;
strcpy(data[0].name,"Aswani");
data[0].balance = 5000;
data[1].acno = 2;
strcpy(data[1].name,"Kumar");
data[1].balance = 500;
data[2].acno = 3;
strcpy(data[2].name,"Ravi Kumar");
data[2].balance = 50;
data[3].acno = 4;
strcpy(data[3].name,"Express");
data[3].balance = 50;
data[4].acno = 5;
strcpy(data[4].name,"Savita");
data[4].balance = 50;

printballes100(data,5);

printf(" Enter your choice 1. for deposit 0. for withdrawl :");
scanf("%d",&p);
printf(" enter a/c no :");
scanf("%d",&acno);
printf(" enter money for transaction:");
scanf("%d",&money);
if(p==1)
{
for(i=0; i<5; i++)
{
if(data[i].acno == acno)
{
data[i].balance+=money;
printf(" Money Deposited to %d account",acno);
}
}
}
else if (p==0)
{
for(i=0; i<5; i++)
{
if(data[i].acno == acno)
if(data[i].balance<100)
printf(" The Balance is insufficient for specified withdrawl");
}
}
getch();                    // comment this if u r using linux.
return 0;
}

void printballes100(struct bankinfo d[],int size)
{
int i;
printf(" Accounts having balances less than 100 are ");
printf(" a/c no name balance ");
for(i=0; i<size; i++)
if(d[i].balance<100)
printf("%d %s %d ",d[i].acno,d[i].name,d[i].balance);
}