Hello There, Guest! Login Register
Advertise Here | Remove Ads

C Program to Check Whether a Number is Positive or Negative

  • 0 Vote(s) - 0 Average
Thread Closed


02-03-2016, 07:02 PM #1
Sadness Offline MODERATOR MODERATORS
Posts:4,001 Threads:565 Joined:Sep 2014 Reputation: 13 Sex Female
FFUC: $0
Country: Bangladesh
Code:
#include <stdio.h>
int main()
{
    float num;
    printf("Enter a number: ");
    scanf("%f",&num);
    if (num<=0)
    {
        if (num==0)
          printf("You entered zero.");
        else
          printf("%.2f is negative.",num);
    }
    else
      printf("%.2f is positive.",num);
    return 0;
}

[Image: SeoClerks728x90.png]







Forum Jump:


Users browsing this thread:1 Guest(s)

Advertise Here | Remove Ads