Wednesday, February 10, 2016

Check: Given number is positive or not using if statement.

#include<stdio.h> 
void main()
{
int number;

printf("Enter number:");
scanf("%d",&number);

if(number > 0)
printf("Number is positive.");

if(number <= 0)
printf("Number is not positive.");
}
/* Output
Enter number:5
Number is positive.
*/

No comments:

Post a Comment