- 1

C++

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 Attempt in comments

28th Sep 2021, 8:21 AM
Mando
Mando - avatar
5 odpowiedzi
+ 1
//int withdrawl = input1 + input2; balance = input1 - input2;
28th Sep 2021, 8:52 AM
Simba
Simba - avatar
+ 1
Mando there isn't any need to make two more variables for inputs to put in withdrawl and expect to get an answer. here's the answer, apologies for responding late. int balance; cin >> balance; int withdrawl; cin >> withdrawl; cout << balance-withdrawl;
28th Sep 2021, 8:52 AM
Rellot's screwdriver
Rellot's screwdriver - avatar
0
#include <iostream> using namespace std; int main() { int balance; int input1; cin >> input1; int input2; cin >> input2; int withdrawl = input1 + input2; balance-=withdrawl; cout << balance; return 0; }
28th Sep 2021, 8:21 AM
Mando
Mando - avatar
0
Whats that mean
28th Sep 2021, 8:32 AM
Mando
Mando - avatar
- 1
Mine works?
28th Sep 2021, 8:27 AM
Mando
Mando - avatar