0
Whatâs can I change
#include <iostream> using namespace std; int main() { int total = 126; int rem; int res; rem = (total % 50); res = (50 - rem); cout << res << endl;//your code goes here return 0; } Input 126 Output 24
11 Respostas
+ 3
You only need one input for passengers
int a;
Take the input of passengers and save into varible.
cin >> a;
The bus has 50 seats.
int b = 50;
You need to know how many seats are empty on the bus.
And calculate how many are left for the next bus.
With the modulo operator you can get the taken seats from the bus.
Use an if else statement
if (a<=50){cout<<b-a;}
else {cout<<b-(a%b);}
+ 2
What is the Lesson number or Practice number?
+ 2
Sorry Yikes i'm working from a memory of many years ago. I wasn't aware that if statements weren't covered yet in the course.
+ 2
lol
int a;
cin>>a;
int b=50;
cout<<b-(a%b);
I guess we didn't need the extra steps after all.
+ 1
What did you do for your attempt? Please show what you wrote.
+ 1
Hello Nik,
Just as a future reference, please use proper tags for your future posts. 'idk' in the tags doesn't specify any subject, and is worthless as search term (click on any word in the tags to see what mean)
https://code.sololearn.com/W3uiji9X28C1/?ref=app
0
11
0
The above is one that i wrote this is the newest:
#include <iostream>
using namespace std;
int main() {
int a;
int b;
int c;
cin >> a;
cin >> b;
c = b % a;
cout << c << endl;
return 0;
}
0
Okay so next question cause i was told to use if and else. But the program hasnt taught this yet. How come its implimented into the test?
0
It worked though thank you!!! I guess the understanding will come with it but is there another way without if or else?
0
Youre mvp i appreciate you greatly