0% found this document useful (0 votes)
4 views15 pages

MRE Muhammad Rizwan Lab

This document is a C program for an ATM simulation that allows users to perform various banking operations such as balance inquiry, withdrawal, deposit, and PIN change. It includes user authentication via a PIN and tracks transaction counts and amounts. The program handles invalid inputs and limits the number of withdrawals to ensure account security.

Uploaded by

sherymalik2306
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views15 pages

MRE Muhammad Rizwan Lab

This document is a C program for an ATM simulation that allows users to perform various banking operations such as balance inquiry, withdrawal, deposit, and PIN change. It includes user authentication via a PIN and tracks transaction counts and amounts. The program handles invalid inputs and limits the number of withdrawals to ensure account security.

Uploaded by

sherymalik2306
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

#include<stdio.

h>

#include<conio.h>

#include<stdlib.h>

void Balance (void);

void Withdraw (void);

void Deposit (void);

void PIN_Change (void);

int pin=6897,i,initialbalance=200000,countw=0,sumw=0,countd=0,sumd=0;

int main()

printf("Wellcome to My Yousaf Hamza's Bank\n");

int npin,opt;

for(i=1;i<=3;i++)

printf("Enter 4 digit Pin\n");

scanf("%d",&npin);

if(npin==pin)

printf("Accesss granted\n");

break;

if(i==3)

printf("Your card is captured contact Admin");

exit (0);

else

printf("Invalid passward\n");

}
system("cls");

for(;;)

printf("1 Balance Enquiry\n2 Amount Withdraw\n3 Amount Deposit\n4 Change the


Pin\n5 Exit\n");

scanf("%d",&opt);

switch (opt)

case 1 :

Balance();

system("cls");

break;

case 2 :

Withdraw ();

break;

case 3 :

Deposit();

break;

case 4:

PIN_Change();

break;

case 5:

system("cls");

printf("In this session:\n");

printf("Total number of withdraw transactions: %d\n",countw);

printf("Total amount withdrawn: Rs.%d\n",sumw);

printf("Total number of deposit transactions: %d\n",countd);

printf("Total amount deposited: Rs.%d\n",sumd);


printf("\nThanks for using ATM machine\n");

exit(0);

break;

default :

printf("**Invalid coice**\n\n Plese Select Right Option\n");

break;

getchar ();

return 0;

void Balance (void)

{ int l;

printf("Your current balance is \t***%d***\n\n\nEnter 0 to return main menu\n 200 for exit
",initialbalance);

for(;;)

scanf("%d",&l);

if (l==200)

exit(0);

else if (l==0)

break;

else

{
printf("Invalid selection\n");

void Withdraw (void)

{ int wamount,l, count=0, flag=0;

for(;;)

if (flag==0 && count<=5)

for(;;)

printf("Your current balance is \t***%d*** \n Enter the


amount to withdraw\n",initialbalance);

scanf("%d",&wamount);

if(initialbalance>wamount && wamount%500==0 &&


wamount>=500 && wamount<=25000)

if ((initialbalance-wamount)>=15000)

initialbalance=initialbalance-wamount;

countw++;

sumw+=wamount;

printf("Please take your amount\n your


current balance is \t***%d***\n",initialbalance);

count++;

break;

}
else

printf("Account must have atleast 15000\n");

break;

else

printf("Sorry Transection can not be Performed\n


Transection Range 500-25000\n Shoud be multiple of 500\n Can not withdraw more then your
current balance\n\n");

break;

flag=0;

printf("\n\nEnter 0 for main menu\n 100 for tarnsection again\n 200 for
exit\n");

scanf("%d",&l);

if (l==100 && count>5)

break;

if (l==100)

continue;

else if (l==200)

exit(0);

else if (l==0)

break;

else

printf("Invalid selection\n");

flag=1;

system("cls");
if (l==100 && count>5)

printf("You have reached maximum limit come other day ***Thanks**\n");

getchar();

void Deposit (void)

int damount,l, flag=0;

for(;;)

if (flag==0 )

for(;;)

printf("Your current balance is \t**%d*** \nEnter the


amount to deposit\n",initialbalance);

scanf("%d",&damount);

if(damount%500==0 && damount>=500)

initialbalance=initialbalance+damount;

countd++;

sumd+=damount;

printf("Your amount has been deposited\n Your


current balance is \t***%d***\n",initialbalance);

break;

}
else

printf("Sorry Transection can not be Performed\nMust be


Multiple and more then 500\n");

break;

flag=0;

printf("\n\nEnter 0 for main menu\n 100 for tarnsection again\n 200 for
exit\n");

scanf("%d",&l);

if (l==100)

continue;

else if (l==200)

exit(0);

else if (l==0)

break;

else

printf("Invalid selection\n");

flag=1;

system("cls");

void PIN_Change (void)

{ int npin,rpin,l;

for(i=1;i<=3;i++)

printf("\nEnter your 4 digit New PIN\n");

scanf("%d",&npin);
printf("\nRe-Enter 4 digit New PIN\n");

scanf("%d",&rpin);

if (npin==rpin)

pin=npin;

printf("PIN has been successfully changed\n");

break;

else

printf("Pin does not matched\n Try again");

for(;;)

printf("\n\nEnter 0 for main menu\n 100 for tarnsection again\n 200 for exit\n");

scanf("%d",&l);

if (l==200)

exit(0);

else if (l==0)

break;

else

printf("Invalid selection\n");

system("cls");

You might also like