What's new

Closed If-else

Status
Not open for further replies.

Kjhee

Addict
Joined
Apr 30, 2017
Posts
15
Reaction
3
Points
65
if-else condition

#include <iostream>

using namespace std;

int main ()
{

int a = 50;

// check for condition
if( a > 100 )
{
// if condition is true then print the following

cout<< " If Condition is satisfied ";
cout << "a is greater than 100" << endl;
}
else
{
// if condition is false then print the following

cout<< " If Condition is not satisfied ";
cout << "a is not greater than 100" << endl;
}

cout << "value of a is : " << a << endl;

return 0;
}

Output:
If Condition is not satisfied
a is not greater than 100
value of a is : 50
 
Simplehan natin yan

#include<stdio.h>
main()

int a;
clrscr();

printf("Enter int: ")
scant("%d", &a);

if(a>50)
{
printf(" Gosurf ");
}

else
{
printf("Mag GS ka nalang");
}

getch();
}

Haha
 
Status
Not open for further replies.

Similar threads

Back
Top