0

Its showing fail even if i enter marks > 35

Help me please https://code.sololearn.com/cwXEo1T3LE2s/?ref=app

5th Jul 2021, 4:14 PM
UJCoder
UJCoder - avatar
2 Respostas
+ 3
Actually you have defined two char type of data name and subject but u have not decleared any array so it will take single char and may be you trying to enter more characters thats why this happening try this one #include <iostream> using namespace std; int main() { char nm[20],sub[20]; int marks; cout<<"Enter name: "; cin>>nm; cout<<"\nEnter Subject: "; cin>>sub; cout<<"\nEnter marks: "; cin>>marks; cout<<"\n\nResult: "; if(marks<35) { cout<<"Fail!"; } else { cout<<"Pass!"; } return 0; }
5th Jul 2021, 4:27 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
Thank u sooo much I forgot it
6th Jul 2021, 10:33 AM
UJCoder
UJCoder - avatar