Nested if else:
//Write a c program to check the number is zero or positive or negative:
Syntax :
if(condition)
{
//Ensure when condition is true
if(condition 2)
{
//statement 1
}
{
statement 2
}
{
statement 3
}
//Write a c program to check the number is zero or positive or negative:
#include<stdio.h>
int main()
{
int num;
printf("Enter a number \n);
scanf(" %d",&num);
if(num>=0)
if(num<=0)
{
printf(" The number is ZERO ");
}
else
{
printf(" The number is POSITIVE \n");
}
else
{
printf("The number is NEGATIVE \n");
}
}
Learning C programming language from basics concept include with PROGRAMS:
https://kodewithgy.blogspot.com/2024/09/learning-c-programming-language-from.html
Tags
Nested if else