If Else Statement in C

Advertisements

If Else Statement in C Switch Case in C


If Else Statement in C

In general it can be used to execute one block of statement among two blocks, in C language if and else are the keyword in C.

if else statement in c

Syntax

if(condition)
{
........
statements
........
}
else
{
........
statements
........
}

In the above syntax whenever condition is true all the if block statement are executed remaining statement of the program neglecting. If the condition is false then else block statement will executed and neglecting if block statements.

Example

#include<stdio.h>
#include<conio.h>

void main()
{
int time=10;
clrscr();
if(time>12)
{
printf("Good morning");
}
else
{
printf("Good after noon");
}
getch();
}

Output

Good morning

If Else Statement in C Switch Case in C

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements