Program that input marks and displays "Congratulations! You have passed." if the marks are 40 or more.

Topic:

If Statement

Problem:

Write a program that input marks and displays "Congratulations! You have passed." if the marks are 40 or more.

Solution:

#include<iostream.h>
#include<conio.h>
int main ()
{
int marks;
cout<<"enter marks";
cin>>marks;
if(marks>40)
cout<<endl<<"Congratulations! you have passed.";
getch();
}

Output:


Let me know in the comment section if you have any question.

Previous Post:
Program to calculate area and perimeter of a triangle.