Thursday, 5 February 2015

Write an if statement that assigns 100 to x when y is equal to 0.

Leave a Comment
/*
Write an if statement that assigns 100 to x when y is equal to 0.
*/


Code :

#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==0)
    {
        x=100;
    }
    cout<<"The value of x = "<<x<<endl;
    cout<<"The value of y = "<<y<<endl;
}
If You Enjoyed This, Take 5 Seconds To Share It