I Need help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 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; }

16th Jun 2021, 6:52 PM
Berg Sabine
Berg Sabine - avatar
10 Answers
+ 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
16th Jun 2021, 7:16 PM
Berg Sabine
Berg Sabine - avatar
+ 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
25th Jan 2022, 11:08 AM
Muhammad Alif Deva Rizqon
Muhammad Alif Deva Rizqon - avatar
+ 1
I want In JavaScript language
20th Dec 2023, 3:16 PM
Sai Deepak Boddepalli
Sai Deepak Boddepalli - avatar
0
What help you need? Where is the problem description? What you tried so far? post your try.. along with your trouble of understanding..
16th Jun 2021, 6:58 PM
Jayakrishna 🇮🇳
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
16th Jun 2021, 7:02 PM
Berg Sabine
Berg Sabine - avatar
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 ..
16th Jun 2021, 7:16 PM
Jayakrishna 🇮🇳
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; }
16th Jun 2021, 7:22 PM
Jayakrishna 🇮🇳
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
16th Jun 2021, 7:26 PM
Berg Sabine
Berg Sabine - avatar
0
Berg Sabine you're welcome..
16th Jun 2021, 7:28 PM
Jayakrishna 🇮🇳
0
int balance = 450000; int withdraw = 9000; cin >> balance; cin >> withdraw; // your code goes here balance -= withdraw; cout << balance << endl;
5th Dec 2021, 2:16 PM
kleiber Pérez Montero
kleiber Pérez Montero - avatar