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”);
             }
      }


Comments

Popular posts from this blog

Implementing Auto-Logout in PHP: Enhancing Security for Your Web App

A Simple and Professional Login Form with Gradient Background

How to Create a YouTube Subscribe Website Widget