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