C++ program to check if the number is greater than 20
Answers
Answered by
15
#include<iostream>
using namespace std;
int main()
{
int num;
cout<<"Enter the number";
cin>>num;
if(num>20)
{
cout<<"The number is greater than 20.";
}
else if(num<20)
{
cout<<"The number is less than 20";
}
else
{
cout<<"The number is 20";
}
return 0;
}
Answered by
4
To understand this example, one must have some understanding of the C++ programming language. Then the program can find out if a number is greater than 20. #include <iostream> using namespace std; int main() { float n1;
cout << "Enter numbers: "; cin >> 20; if(n1 >= 20) { cout << "20" << n1;} return 0; } In this way, if a number is greater than 20, the value will be returned by the program.
Similar questions