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
1 Antwort
+ 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..