C Nested if-else Statement :

Nested if-else :

An if statement may have another if statement in the <true block> and <false block>, this compound statement is called nested if statement.

Example :

  1. /* Description: program to find biggest of three numbers use nested if-else */
  2. #include<stdio.h>
  3. main()
  4. {
  5. int a,b,c,big;
  6. printf("\n Enter three numbers:\n");
  7. scanf("%d%d%d",&a,&b,&c);
  8. if(a>b)
  9. if(a>c)
  10. big=a;
  11. else
  12. big=c;
  13. else
  14. if(b>c)
  15. big=b;
  16. else
  17. big=c;
  18. printf("\n Biggest number is: %d",big);
  19. getch();
  20. }

Output :

c language - program to find biggest of three numbers use nested if-else

Next Update

Loading...

Currently, we are working on other servers, but soon we update our website with new content. So, stay tuned we are back soon with new content.

Free Courses