0
Its showing fail even if i enter marks > 35
Help me please https://code.sololearn.com/cwXEo1T3LE2s/?ref=app
2 Antworten
+ 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;
}
+ 1
Thank u sooo much
I forgot it