Skip to main content
To Get All Information of Sarkari Jobs | Results | Admit Card | And courses ,Internships then CLICK HERE

if-else-if Ladder-:


C language support if-else-if  statement to test additional condition apart from the initial text expression.In this kind of statement numbers of logical statement is checked for executing various statement,if any logical statement is TRUE then compiler executes the block followed by if condition
otherwise it skipes and execute else block.
ads


Syntax-:
if(condition-1)
statement-1;
elseif(condition-2)
statement-2;
elseif(condition-3)
statement-3;
else
statement-4;
}
Example-:
#include<stdio.h>
#include<conio.h>
main()
{char ch;
   printf("Enter any character");
   scanf("%c",&ch);
   if(ch>=65)&&(ch<=90)
   printf("%c is an alphabet in uppercase",ch);
   elseif(ch>=97)&&(ch<=122)
   printf("%c is an alphabet in lower case",ch);
   elseif(ch>=48)&&(ch<=57)
   printf("%c is a digit",ch);
   else
   printf("%c is a special symbol",ch);
   getch();
}
Output-:Enter any character S
               S is an alphabet in uppercase

NOTE-: Numeric values in above program are the ASCII values of characters,to learn more about ASCII values, CLICK HERE
ads

Watch The Video Below






Comments

Post a Comment

Please do not enter any spam link in the comment box.


Download The Book "Let Us C" By Yashavant P.Kanetkar,Click The Below Button

-->Email Subscription

Enter Your Email Address:-

Delivered by FeedBurner

Copyright © 2020 TechProgramiz|All Right Reserved|Made By-: Sudarshan Pandey