if…else Statement in C

  if…else Statement in C

{tocify} $title={Table of Contents}

if..else statement is a very powerful two-way decision making statement which allow the programmer to execute one set of statement (out of two) and another to ignore, depends upon the certain specified test-condition. 


  • if evaluated to TRUE then the statement(s) inside the TRUE-Block are executed and the statement(s) inside the FALSE-Block are skipped/ignored; and execution continues with very first statement outside the if..else i.e. statement-x
  • Otherwise, (if FALSE) the statement(s) inside the TRUE-Block are skipped/ignored and the statement(s) inside the FALSE-Block executed and execution continues with very first statement outside the if..else i.e. statement-x
    • example

      👉👉Program to find Greatest among two integers👈👈

      #include<stdio.h>
      main()
      {
             int num1=50, num2=20;
             if(num1>num2)
             {
                         printf(“\nNum1 is Greatest”);
             }
             else
             {
                         printf(“\nNum2 is Greatest”);
             }
      }


Vishvesh Shivam

Vishvesh Shivam is the dynamic founder of TheVsHub.in, a platform he is continually refining with his passion and dedication. A web developer and student based in the scenic Himachal Pradesh, Vishvesh embodies self-reliance and innovation. His quick decision-making ability and relentless drive set him apart, fueling his mission to elevate TheVsHub.in every single day.

Post a Comment

We Love Hearing from You!
Thank you for reading our post! Your thoughts and opinions are important to us. Please leave a comment below to share your feedback, ask questions, or start a discussion. We look forward to engaging with you!

Note: Comments are moderated to ensure a respectful and positive environment.

Previous Post Next Post
Code Copied!