ATM program in C
Hi every one .welcome to my website. I am Kusum for bca expert. now in this website I want show you ,how you can build an ATM program in c. using only c language .so without wasting much time lets quickly get started.
So execute this program we shall use code block.
you can use anther softer also . for example you can use turbo C++,or you can also use the DVC ++
so first you can write any program you must write header file right.
So in this program we use the header file is #include<stdio.h>
stdio.h means it is stander input output header .
next we write int main. it is start line of our program.
after we write float x,y because we need two variables. you can choose any variable a or b so like this.
next char ch . in program we need character type variable so i write the ch.
next printf we print the enter initial amount \n . \n means print next line.
scanf %f &x .here we use one variable for x.
next we check it out credit debit, and balance right so that's why we print enter \n c for credit aging \ n
for debit \n for balance like this we print.
scanf function \n %c & Ch. after that we write switch(ch).
next we write cases for credit, debit and balance.
so first case for credit . print enter the amount \n and scanf %f &y here we use anther variable for y.
x=x+y it means credit . in this help of we know the credit amount. so next new amount =%f ,x
break . means stop coding for credit .
so next you can check the debit and balance right .
so inthat first we check the debit .in debit you can see the two condition here
what are those means the first one is the you can easly see the what is the debit in your account .
another one is the balance is less than your account but you enter the more amount compare to the in
your account. this condition we use one if condition here so lets see that .
so case d for debit right print enter debit amount .next you can write scanf %f &y we use the
condition here if(x>=y ) it means the amount is highest compare to he in your account .in your account
the amount only 4000 but you enter in ATM 8000 then this error will come . that error is insufficient
amount in your account .like this come . else you can writs sufficient amount then show you current
amount. so remains we check the balance right .so its to easy case b for balance.
so we print amount in your account %f ,x next break so over after that we write default
last we write one printf statement choose the correct option for operation
one question will arras right . why we add the printf statement the choose current option for operation
because we check the credit ,debit and one for is balance so that's why we use this printf statement.
so you see out like this in below.
that's it guys . fir any doubts or any question regrading this program you can aske i will replay
earliest . so thanks for watching . visit again.
0 Comments