Create a C++ program to accept two integers and check if it is greater than or equal to 20. Explain and how it works?
//Explain in code with comment
#include <iostream>
using namespace std;
int main()
{
int a,b;
cout<<"Input a:=";
cin>>a;
cout<<"Input b: ";
cin>>b;
if(a>=20&&b>=20)//Check each integers numbers if a also b
//is equal or greater to 20 then do
{
cout<<"Yes both numbers are greater or equal\n\n";
}
//if a and b are less than 20 then do
else
{
cout<<"No\n\n";
}
return 0;
}
Comments
Leave a comment