- 1
Transportation first test
hey honestly i dont know how to make the thing work here is what i made so far. #include <iostream> using namespace std; int main() { //zĂskĂĄnĂ promÄny int a,b,c,d,x; a=50; cout << ""; cin >> b; c=b%a; if (c>'50') { x=b/a; } if (c<='50'); { d=a-b; cout << d; } return 0; }
2 Answers
+ 2
You are extremely over complicating this challenge! Lots of your code is unnecessary and can be done a lot easier.
The code I used is just 11 lines:
#include <iostream>
using namespace std;
int main() {
int passengers;
cin >> passengers;
passengers = passengers%50;
int los = 50 - passengers;
cout << los;
return 0;
}
All you need to do is get the input of the amount of passengers, find the remainder when dividing it by 50. Then take that away from 50 and output the result. If this works please reply and tell me
+ 1
Yes it works!Thank you.