Write a program that read the value of x and evaluate the following function using if statement and ?: Operator

#include <stdio.h>
#include <conio.h>


void main()
{
       clrscr();
    int x,y;
       scanf("%d", &x);
    if(x==0)
        y=0;
    else
        y=(x>0)?1:-1;

    printf("%d",y);
       getch();
}
Next Post Previous Post
No Comment
Add Comment
comment url