Tuesday, November 17, 2009

C Program using if,else

#include
#include
void main()
{
int x,y;
printf("enter value of x");
scanf("%d",&x);
if(x>0)
{
printf("The value of y is 2");
}
else if(x==0)
{
printf("value of y is 0");
}
else
{
printf("value of y is -2");
}
printf("value of y is %d",y);
}

No comments: