IF Else in C

The if..else statement is an extension of the simple if statement.the following syntax is if..else.

Syntax


if(true condition)	
{
	true statement
}
else
{
	false statement
}						
							

the above syntax if expression is true then true block is execute otherwise false block is execute in this if..else statement.

Example


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

void main()
{
	int age;
	clrscr();
	
	printf("Enter Your Age:");
	scanf("%d",&age);
	
	if(age = > 18)
	{
		printf("You are Eligible for Vot")
	}
	else
	{
		printf("You are Not Eligible for Vot");
	}
	getch();
}
							
Share Share on Facebook Share on Twitter Share on LinkedIn Pin on Pinterest Share on Stumbleupon Share on Tumblr Share on Reddit Share on Diggit

You may also like this!