Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

PROGRAM FOR Y = 1 IF X > 0 Y = 0 IF X = 0 Y = -1 IF X < 0

Posted By: Alberto Ross     Category: C Programming     Views: 1830

PROGRAM FOR
Y = 1 IF X > 0
Y = 0 IF X = 0
Y = -1 IF X < 0

Code for PROGRAM FOR Y = 1 IF X &gt; 0 Y = 0 IF X = 0 Y = -1 IF X &lt; 0 in C Programming

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

void main()
{
    int x,y;
    clrscr();

    printf("Enter the value of x :: ");
    scanf("%d",&x);

    if(x > 0)
    printf("Value of y is ::  1");

    if(x == 0)
    printf("Value of y is ::  0");

    if(x < 0)
    printf("Value of y is ::  -1");

    getch();
}


/*
********
OUTPUT
********

Enter the value of x :: 23
Value of y is :: 1
*/
  
Share: 



Alberto Ross
Alberto Ross author of PROGRAM FOR Y = 1 IF X > 0 Y = 0 IF X = 0 Y = -1 IF X < 0 is from Houston, United States.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!