WAP to input a no. from user and check whether it is negative or positive with the help of conditional operator?

 


#include<stdio.h>

#include<conio.h>

Void main ()

{              int x;

               clrscr();/* clear the previous output from the console*/

               printf(“enter any no: ”);

               scanf(“%d”,$x);

(x>=0)? printf(“its is positive no.”):print(“it is negative no.”);

getch();

}

Output is:-

Enter any no: 5

It is positive no.

Post a Comment

0 Comments

Ad Code

Responsive Advertisement