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

31st Jul 2021, 9:18 PM
Peeposad
Peeposad - avatar
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
31st Jul 2021, 9:46 PM
Pieter Edwards
Pieter Edwards - avatar
+ 1
Yes it works!Thank you.
1st Aug 2021, 9:21 AM
Peeposad
Peeposad - avatar