In C Programming Language one of the other ways to check condition is Else if ladder statement. It checks the multipath decision involved in the statement.

Syntax of else if ladder statement

if(some_condition)
{
statement;
}
else if(some_condition)
{
statement;
}
else if(some_condition)

statement;
}
. . . . ./* else here optional it’s depend’s on us */
else
{
statement
}

Simple Program of Ladder if else statement in C

Print the greatest of three Number.

#include <stdio.h>
#include<conio.h>
void main()
{
int x,y,z;
clrscr();
printf(“Please Enter three Number:n”);
scanf(“%d%d%d”,&x,&y,&z);
if(x>y && x>z)
{
printf(“X is greatest Number: %d”,x);
}
else if(y>z)
{
printf(“Y is greatest Number: %d”,y);
}
else
{
printf(“Z is greatest Number: %d”,z);
}
getch();
}

Output:
Enter three Number 10   2   30

Y is greatest Number: 30

This article is written by our awesome writer
Comments to: Else If Ladder Statement In C Programming Language

Your email address will not be published. Required fields are marked *

Attach images - Only PNG, JPG, JPEG and GIF are supported.

New Dark Mode Is Here

Sign In to access the new Dark Mode reading option.

Explore Tutorials By Categories

Login

Welcome to Codeverb

Ready to learn something new?
Join Codeverb!

Read Smart, Save Time
  •  
    Strength indicator
  •  
  •  
    Log In | Lost Password