• Language

    C

  • Description

    It reads a number and informs the user if it is positive or negative.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <stdio.h>
#include <stdlib.h>

int main (void)
{
    float a_number;
    printf ("Enter the value of a number: ");
    scanf ("%f", &a_number);
    (void) getchar ();
    if(a_number<0)
        printf ("Negative\n");
    else
        printf ("Positive\n");
    putchar ('\n');
    system ("pause");
    return EXIT_SUCCESS;
}