You are on page 1of 4

assignment

Programing Fundamental
Department :
BSCS-ll
Roll No:
28
Submitted By :
Hamza Farooq
Submitted To :
Prof. Faheem
Punjab College Pattoki
Question # 1:
Q.1: Write a program that create a data structure which store the information of
Bank Account for two persons. It is also update the account status for each
person after deposit and withdraw an amount into their account. After this it
show the current balance of both persons.

Problem statement
Person1 current balance 2000 and person2 has 2780 into their account.

Statement of code
Person1 deposit 1780 and withdraw 1320 and Person2 deposit 5000 and
withdraw 7000.
Answer:
#include <stdio.h>
#include<string.h>
struct bank
{
int account_no;
int current_balance;
int new_balance;
}b;
int main()
{
int num1=2000 ,num2=2780 ,x=3780,y=7780,sum;
b.account_no = 36627;
b.current_balance =2000;
b.new_balance;

bank b1;
num2=2780 ;
b1.account_no = 36628;
b1.current_balance =2780;
b1.new_balance;

printf("BANK ACCOUNT INFORMATION \n");


printf("person 1 \n");
printf("Account NO:%d\n", b.account_no);
printf("your current balance is:%d\n", b.current_balance);

printf("Enter deposite ammount:\n ");


scanf("%d", &b.current_balance);
sum = b.current_balance + num1;
printf("your new balance is %d + %d = %d\n", b.current_balance, num1, sum);

printf("Enter withdraew ammount:\n ");


scanf("%d", &b.new_balance);
sum = x - b.new_balance ;
printf("your new balance is %d - %d = %d\n", x, b.new_balance, sum);
printf("person 2 \n");
printf("Account NO:%d\n", b1.account_no);
printf("your current balance is:%d\n", b1.current_balance);

printf("Enter deposite ammount:\n ");


scanf("%d", &b1.current_balance, &num2);
sum = b1.current_balance + num2;
printf("your new balance is = %d + %d = %d\n", b1.current_balance, num2,
sum);

printf("Enter withdraw ammount:\n ");


scanf("%d", &b1.new_balance);
sum = y - b1.new_balance ;
printf("your new balance is %d - %d = %d\n", y, b1.new_balance, sum);
}

You might also like