Write a C program to check whether number is positive, negative or zero
Description:
You need to write a C program to check whether number is positive, negative or zero
Conditions:
- Create variable with name of number and the value will taken by user or console
- Create this c program code using else if ladder statement
#include <stdio.h>
int main()
{
int number;
printf("Enter a number : ");
scanf("%d", &number);
if (number >= 0)
printf("%d is positive \n", number);
else if(number==0)
printf("%d is zero \n", number);
else
printf("%d is negative \n", number);
return 0;
}
Tutorials Class - Output Window
Enter a number : 10
10 is positive
Learn more about the similar topics:
Tutorials |
---|
No Content Found. |
Exercises & Assignments |
---|
No Content Found. |
Interview Questions & Answers |
---|
No Content Found. |