Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

#include <iostream>

using namespace std;

int main()

int x,y;

//int a, b;

cout<<"please enter the 1st no.";

cin>>x;

cout<<"please enter the 2nd no. ";

cin>>y;

// arithmetic operators

cout<<"sum = "<<x+y<<endl;

cout<<"product= "<<x*y<<endl;

cout<<"division= "<<x/y<<endl;

cout<<"difference= "<<x-y<<endl;

cout<<"remainder = "<<x%y<<endl;

// relational operators

int eql=x==y;

int notEql=x!=y;

int gt=x>y;

int gte=x>=y;

int lt=x<y;

int lte=x<=y;
cout<<"x==y "<<eql<<endl;

cout<<"x!=y "<<notEql<<endl;

cout<<"x>y= "<<gt<<endl;

cout<<"x>=y "<<gte<<endl;

cout<<"x<y "<<lt<<endl;

// logical operators

int lor=x+2>4 || y-2<3;

int land=x+2>4 && y-2<3;

int lnot=!(x+2>4);

cout<<"x+2>4 || y-2<3= "<<lor<<endl;

cout<<"x+2>4 && y-2<3= "<<land<<endl;

cout<<"!(x+2>4)= "<<lnot<<endl;

// i,ncrement & decrement operators

cout<<"x++= "<<++x<<endl;

//int ypl=y++;

//cout<<"y++= "<<y++<<endl;

cout<<"y++ 1st= "<<y++<<endl;

int z= y++*2+x;

cout<<"z= "<<z<<endl;

cout<<"y++ 2nd = "<<y++<<endl;

// precedence operator

int po= x+y*2 > 10 && y-x/4>2;


cout<<"po "<<po<<endl;

// hh

int hd=0xF2F2;

int hd1=hd<<2;

cout<<"hd= "<<hd;

You might also like