134k views
0 votes
write a program using if condition and print fail and try again if student marks are less than 33 using if condition and print fail and try again if student marks are less than 33

1 Answer

3 votes

Answer:

Following are the program to this question:

#include <iostream>//defining a herader file

using namespace std;

int main()//defining main method

{

int marks, i=35;//defining integer variables

cout<<"enter your marks in a percent: ";//print message

cin>>marks;//input marks value

if(marks<i)//defining if block that checks marks less then i

{

cout<<"fail and try again";//print message

}

else//defining else block

{

cout<<"You are qualified";//print message

}

return 0;

}

Output:

enter your marks in a percent: 33

fail and try again

Step-by-step explanation:

In the above-given, C++ language code inside the main method "marks and i" two integer variable is declared, in which the "i" variable holds a value.

In the next step, if block is defined, that checks "marks" value is less than "i", if the value is true, it will print "fail and try again".

Otherwise, it will go to the else block, in this, it will print "You are qualified".

User Jerry Hicks
by
5.7k points