Kamal would like to withdraw X Rs from an ATM. The cash machine will
only accept the transaction if X is a multiple of 100, and kamal's account balance has enough cash to
perform the withdrawal transaction. For each
successful withdrawal the bank charges 50 Rs. Calculate Kamal's account
balance after an attempted transaction.
#include<iostream>
using namespace std;
int main(){
int karmal_original_amount = 10000; //The originL value can be modified
int X;
cout<<"Enter amount for withdrawal "<<endl;
cin>>X;
int account_balance;
if(X% 100==0){
account_balance = karmal_original_amount - X;
}
else{
cout<<"The amount for withdrawal is not a multiple of 100 \n";
account_balance = karmal_original_amount;
}
cout<<"Kamal's account balance after the attempted transaction is \t"<<account_balance;
}
Comments
Leave a comment