check whether a number is positive, negative or zero
#include <stdio.h>int main()
{
int num;
printf("Enter any number: ");
scanf("%d", &num);
if(num > 0)
{
printf("Number is POSITIVE");
}
if(num < 0)
{
printf("Number is NEGATIVE");
}
if(num == 0)
{
printf("Number is ZERO");
}
return 0;
}
--------------------------------------------------------------------------------------------
#include <stdio.h>
int main();
{
int num;
printf("Enter any number: ");
scanf("%d", num);
if(num==0)
{
printf("Number is ZERO");
}
else
{
if(num > 0)
{
printf("Number is POSITIVE");
}
else
{
printf("Number is NEGATIVE");
}
}
}
---------------------------------------------------------------------------------------------
check whether a number is divisible by any number
No comments:
Post a Comment