Header Ads Widget

C program to check whether a number is negative, positive or zero

 C program to check whether a number is negative, positive or zero

Given a numbers , write a program to check that whether a number is negative, positive or zero .

Sample input

4

Sample output

Number is Positive number

C program to check whether a number is negative, positive or zero

The objective of the code is to check whether a number is negative, positive or zero .

Code(C):-

#include<stdio.h>
int main()
{
int a;
scanf("%d",&a);
if(a==0)
printf("Number is zero");
else if(a>0)
printf("Number is Positive number");
else
printf("Number is negative number");
}

Output:-

4
Number is Positive number

Recommended Post :-

HCL Coding Questions:-

Capgemini Coding Questions:-

Companies interview:-

Full C course:-    

Key points:-

Cracking the coding interview:-

 Array and string:-

Tree and graph:-

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-

 MCQs:-

Post a Comment

0 Comments