Example 1:
// Relational Operators in C
#include <stdio.h>
int main()
{
int a,b;
printf("Enter the values of a and b \n");
scanf("%d %d", &a,&b);
if(a > b)
printf("%d is greater than %d\n",a,b);
else if(a < b)
printf("%d is less than %d\n",a,b);
if(a <= b)
printf("%d is less than or equal to %d\n",a,b);
else if(a >= b)
printf("%d is greater than or equal to %d\n",a,b);
if(a == b)
printf("%d is equal to %d\n",a,b);
else if (a != b)
printf("%d is not equal to %d\n",a,b);
return 0;
}
//Video Tutorial
Example 2:
// Relational Operators in C++
#include <iostream>
using namespace std;
int main()
{
int a,b;
cout <<"Enter the values of a and b \n";
cin >>a >>b;
if(a > b)
cout <<a <<" is greater than " <<b <<"\n";
else if(a < b)
cout <<a <<" is less than " <<b <<"\n";
if(a <= b)
cout <<a <<" is less than or equal to " <<b <<"\n";
else if(a >= b)
cout <<a <<" is greater than or equal to" <<b <<"\n";
if(a == b)
cout <<a <<" is equal to" <<b <<"\n";
else if (a != b)
cout <<a <<" is not equal to " <<b <<"\n";
return 0;
}
// Relational Operators in C
#include <stdio.h>
int main()
{
int a,b;
printf("Enter the values of a and b \n");
scanf("%d %d", &a,&b);
if(a > b)
printf("%d is greater than %d\n",a,b);
else if(a < b)
printf("%d is less than %d\n",a,b);
if(a <= b)
printf("%d is less than or equal to %d\n",a,b);
else if(a >= b)
printf("%d is greater than or equal to %d\n",a,b);
if(a == b)
printf("%d is equal to %d\n",a,b);
else if (a != b)
printf("%d is not equal to %d\n",a,b);
return 0;
}
//Video Tutorial
Example 2:
// Relational Operators in C++
#include <iostream>
using namespace std;
int main()
{
int a,b;
cout <<"Enter the values of a and b \n";
cin >>a >>b;
if(a > b)
cout <<a <<" is greater than " <<b <<"\n";
else if(a < b)
cout <<a <<" is less than " <<b <<"\n";
if(a <= b)
cout <<a <<" is less than or equal to " <<b <<"\n";
else if(a >= b)
cout <<a <<" is greater than or equal to" <<b <<"\n";
if(a == b)
cout <<a <<" is equal to" <<b <<"\n";
else if (a != b)
cout <<a <<" is not equal to " <<b <<"\n";
return 0;
}
thank you sir for define operator in simple way
ReplyDelete