- 2
I Need help
#include <iostream> using namespace std; int main() { int balance; int withdraw; cin >> balance; cin >> withdraw; // your code goes here return 0; }
10 Respostas
+ 5
You want to withdraw some money from your bank account.
The program takes two numbers as input, your account balance and the amount you want to withdraw. Calculate and output the remaining balance after the withdrawal.
Sample Input
450000
9000
Sample Output
441000
+ 2
#include <iostream>
using namespace std;
int main() {
int balance;
int withdraw;
cin >> balance;
cin >> withdraw;
// your code goes here
cout<<balance-withdraw;
return 0;
}
Good Luck
+ 1
I want In JavaScript language
0
What help you need? Where is the problem description? What you tried so far? post your try.. along with your trouble of understanding..
0
I'm trying completely new c ++ and unfortunately don't know how to solve the task .. I would be very happy if someone could tell me the code so I can see it and maybe understand it. I know it's beginnings but I've never looked at it before. Unfortunately I couldn't understand the answer in books either, unfortunately the calculations in my books are completely different. best regards
0
Ok. Then first complete c++ course .. observe samples, use try yourself from lessons.. what ever I post is almost same you see on book. So Read again and ask specifics here if you not understanding something..
How can we help if we don't know what is the task about..?
I think " if there is sufficient amount in account ,you can draw else you can't. " is the description to make code.. for this :
#include <iostream>
using namespace std;
int main() {
int balance;
int withdraw;
cin >> balance;
cin >> withdraw;
// your code goes here
if(balance>=withdraw)
{
balance = balance-withdraw;
cout<<"withdrawn "<<balance;
}
else
cout<<"insufficient balance";
return 0;
}
this is sample code which works ..
0
Sample Input
450000
9000
You are taking this values into balance and withdraw so remaining amount is 450000-9000=441000
So output it by
cout<<(balance-withdraw);
add this line in program then it works ..
edit:
Berg Sabine
#include <iostream>
using namespace std;
int main() {
int balance;
int withdraw;
cin >> balance;
cin >> withdraw;
// your code goes here
cout<<balance-withdraw;
return 0;
}
0
Thank you, you have now helped me a lot to understand this .. !! Learning is very important to me. Even if computers and programming are brand new. I thank you from the bottom of my heart
0
Berg Sabine you're welcome..
0
int balance = 450000;
int withdraw = 9000;
cin >> balance;
cin >> withdraw;
// your code goes here
balance -= withdraw;
cout << balance << endl;