Q) Write a C program to check the given number is positive negative and zero.
The program can be solved by using multiple if statements.
The program can be solved by using multiple if statements.
#include<stdio.h>
#include<conio.h>
main()
{
int num;
clrscr();
printf("Enter any number :- ");
scanf("%d",&num);
if(num>0)
{
printf("Given number is positive");
}
if(num<0)
{
printf("Given number is negative ");
}
if(num==0)
{
printf("Given number is Zero ")
}
getch();
}
O/P: Enter any number :- 3
Given number is positive.
0 comments:
Post a Comment