In: Computer Science
Include<stdio.h>
In C program
Write a program that prompts the user to enter an integer value.
The program should then output a message saying whether the number is positive, negative, or zero.
#include <stdio.h>
int main()
{
int input;
printf("Please Enter a integer value:"); // read user input from
console.
scanf("%d",&input);
if(input<0){ // if block checks wheter is less than zero
printf("you entered value is negitive");
}else if(input>0){ // else if block checks whether the input is
greater than zero
printf("you entered value is positive");
}else // checks whether the input is excatly equal to zero.
printf("you entered value is zero");
return 0;
}
output:
when input is zero:
output when input is positive:
output when input is negitve :
comments:
the above code is executable one with output screenshots ..and program coments;