C++ if else program

in program •  7 years ago 

Simple if-else program


Source

#include < iostream>

using namespace std;

int main() // Most important part of the program!

{

int age; // Need a variable...

cout<<"Please input your age: "; // Asks for age

cin>> age; // The input is put in age

if ( age <= 30 ) { // If the age is less than 100

 cout<<"You are pretty young!\n"; // Just to show you it works..

}

else {

cout<<"You are really old\n";     // Executed if no other statement is

}

return 0

}

Output :
Please input your age: 20
You are pretty young!

I hope you like this.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

thanks for this coding.. happy to see u again..

i m also a programmer... i like your program

ahmm nice brother

very nice information

i love programming

keep it up