25: W.A.P. to decide whether no is positive, negative or zero.

 

25: W.A.P. to decide whether no is positive, negative or zero.

Program:

#include <stdio.h>

#include <conio.h>

 

void main()

{

    clrscr();

    int num;

 

    printf("Enter the number = ");

    scanf("%d", &num);

 

    if (num > 0)

    {

        printf("%d = Positive", num);

    }

    else if (num < 0)

    {

        printf("%d = Negative", num);

    }

    else

    {

        printf("%d = Zero", num);

    }

    getch();

}


Please follow me for more practicals....


           

Output:

Enter the number = -5

-5 = Negative


Please follow me for more practicals....


Algorithm:

1.      START

2.      Declare num

3.      Enter the num

4.      If (num > 0) then goto step 5 else goto step 6.

5.      Display num is positive.

6.      If (num < 0) then goto step 7 else goto step 8.

7.      Display num is negative.

8.      Display num is zero.

9.      STOP.

 

Please follow me for more practicals....


Flowchart:



Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.