Wednesday, 16 April 2014

Compare Two Values- Relational Operators- Using C++

#include<iostream>     // Including Header File
using namespace std;  // C++ Program Standard
int main()                              
{
   int num;  // variable declaration
   cout<<"Enter a number:";               // print enter a number :
   cin>>num;                           // run time user input
 
   cout<<"num < 10 is = "<< (num < 10) <<endl;    // comparing no' s
   cout<<"num > 10 is = "<< (num > 10) <<endl;    // comparing no' s
   cout<<"num == 10 is = "<< (num == 10) <<endl;  //comparing  no' s
 
}

Output:


No comments:

Post a Comment