Thursday 5 February 2015

write an if/else statement that assigns 0 to x when y is equal to 10. Otherwise it should assign 1 to x.

Leave a Comment
/*
write an if/else statement that assigns 0 to x when y is equal to 10. Otherwise it should assign 1 to x.
*/
#include<iostream>
using namespace std;
void main()
{
    int x=0,y=0;
    cout<<"Enter the value of x = ";
    cin>>x;
    cout<<"Enter the value of y = ";
    cin>>y;
    if(y==10)
    {
        x=0;
    }
    else{
    x=1;
    }
    cout<<"The value of x = "<<x<<endl;
    cout<<"The value of y = "<<y<<endl;
}
If You Enjoyed This, Take 5 Seconds To Share It

0 Questions: