Nested if else in c

Nested if Else Statement In C Language in Hindi

C

Nested if Else Statement In C Language in Hindi:- Nested If else Statement Ko samajh ne ke liye ham is post me C programming nested if else ke example ko Dekhte hai or Fir iske kuch nested in c program banate hai.

C nested if else condition ke under ek or if else condition jo hoti hai. usse hi ham nested if else c kahte hai.

Nested if Else Statement In C Language in Hindi

Contents

C nested If else Statement ka ham pahle syntax Dekhte hai .

If else condition ke under ek or if else condition hoti hai. usse hi ham nested c if else kahte hai.

if(condition) {
    //Nested if else inside the body of "if"
    if(condition2) {
       //Statements inside the body of nested "if"
    }
    else {
       //Statements inside the body of nested "else"
    }
}
else {
    //Statements inside the body of "else"
}

C Nested If Else statement syntax me expression ko check kar rhe hai or uske bad us statement ke under ek or condition check kar rhe hai and uske bad ham statement ko print kar rhe hai.

Nested If Else Statement in c Flow Chart

Nested in c Flow Chart

Nested Else If Statement ko acchi tarah se samajh ne ke liye ham ab ek program banate hai. and usme ek condition lga ke us program ko run karte hai.

Example of nested if..else

#include <stdio.h>
#include <conio.h>
int main()
{
   int var1, var2;
   printf("Input the value of var1:");
   scanf("%d", &var1);
   printf("Input the value of var2:");
   scanf("%d",&var2);
   if (var1 != var2)
   {
	printf("var1 is not equal to var2\n");
	//Nested if else
	if (var1 > var2)
	{
		printf("var1 is greater than var2\n");
	}
	else
	{
		printf("var2 is greater than var1\n");
	}
   }
   else
   {
	printf("var1 is equal to var2\n");
   }
   return 0;
}

Output :-

Input the value of var1:12
Input the value of var2:21
var1 is not equal to var2
var2 is greater than var1
Nested If Else Statement kese work karta hai ?

C Nested if else statement kese work karta hai ham is photo ki image se understand karte hai.

Nested If Else Statement kese work karta hai ?

Nested If Else Statement kese work karta hai ?
Program Nested if else :- Write A Program to find largest of three number ?
#include<stdio.h>
#include<conio.h>

void main()
{
    int a,b,c;
    printf("Enter The Three Number :");
    scanf("%d %d %d",&a,&b,&c);

    if(a>b)
     {  
        if(a>c)
             {
                   printf("Greater Number %d",a);
              }
        else
              {
                   printf("Greater Number %d",c);
               }
       }
    else
     {
             if(b>c)
              {
                 printf("Greater Number %d",b);
              }
              else
               {
                  printf("Greater Number %d",c);
                }
      }
   getch();
}

Output :-

Enter The Three Number : 10 20 30
Greater Number 30

How To Use if Statement With Example in C

Dosto mujhe ummed hai ki aap Nested if else statement in c example in Hindi ko acchi tarah se samanj gye honge agar aap ko ye post acchi lage to mere is website ko jarur follow kre or ha agar aap video bhi dekhna chahte hai to aap mere channel ko bhi subscribe kar sakte hai. channel ka link aapko home page par mil jayega |

Leave a Reply

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