My code is not running , int empty_seats = 50 - left passengers ; | What is fault in this line ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

My code is not running , int empty_seats = 50 - left passengers ; | What is fault in this line ?

#include <iostream> using namespace std; int main() { int passengers ; cout << "" << endl ; cin >> passengers ; int left_passengers ; left_passengers = passengers % 50 ; int empty_seats = 50 - left_passengers ; cout << "empty_seats" << endl ; return 0; } https://www.sololearn.com/discuss/3103740/?ref=app

14th Nov 2022, 9:38 AM
Keshav Karn
Keshav Karn - avatar
1 Answer
+ 4
Don't output anything extra other than asked in description.. Oh.. cout << "empty_seats" ; outputs string.. Anything between quotes is a string, not variable. Use cout << empty_seats << endl; // output empty_seats variable value.. edit: #include <iostream> using namespace std; int main() { int passengers ; cin >> passengers ; int empty_seats = 50 - passengers % 50 ; cout << empty_seats << endl ; return 0; } //you could even just use single variable..
14th Nov 2022, 9:56 AM
Jayakrishna 🇮🇳