How is my code wrong ? Even when its matching with expected results | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How is my code wrong ? Even when its matching with expected results

https://www.sololearn.com/coach/902?ref=app

21st Jul 2021, 10:39 AM
Adi
Adi - avatar
6 Answers
+ 2
You are not supposed to print anything except y variable
21st Jul 2021, 12:40 PM
Atul [Inactive]
+ 2
Adi Hi First of all you actually can calculate with only one line: result = 50 - ( x % 50); Where x is input number. And SoloLearn input and output should be without any message, meaning: cin >> x; cout << result; Good luck
22nd Jul 2021, 6:54 PM
Reza Banivakil
Reza Banivakil - avatar
+ 1
Copy your code and paste it here
21st Jul 2021, 11:19 AM
Atul [Inactive]
0
It might have to do with spacing or the way it was given, however we cant see the code with the link you gave. Would you add the code to your question?
21st Jul 2021, 10:47 AM
Brain & Bones
Brain & Bones - avatar
0
No, copy your code and send it to me
21st Jul 2021, 11:13 AM
Brain & Bones
Brain & Bones - avatar
0
#include <iostream> using namespace std; int main() { //your code goes here int x,y,z; cout<<"enter num of passenger waiting \n"; cin>>x; z=x; x=x/50; z=z-(x*50); y= 50-z; cout<<"seats left: "<< y <<endl; return 0; }
21st Jul 2021, 12:28 PM
Adi
Adi - avatar