# isgreaterequal() in C/C++

CC++Server Side Programming

The function isgreaterequal() is used to check that the first argument is greater than or equal to the second one. It is declared in “math.h” header file in C language. It returns true on success, otherwise false.

Here is the syntax of islessgreater() in C++ language,

bool isgreaterequal(value1 , value2);

Here,

value1 − This is the first argument which will be checked with value2.

value2 − This is the second argument which is used to check value1 that is greater or equal.

Here is an example of isgreaterequal() in C++ language,

## Example

Live Demo

#include<iostream>
#include<math.h>
using namespace std;
int main() {
int val1 = 28;
int val2 = 8;
bool result;
result = isgreaterequal(val1, val2);
cout << "val1 isgreaterequal than val2 : " << result << endl;
return 0;
}

## Output

val1 isgreaterequal than val2 : 1

In the above example, two values are compared and one of them is less or greater than the other. It checks value1>value2 || value1=value2. If one of them ( value1>value2 OR value1=value2 ) is true, it will return 1. Otherwise, it will return 0.

Now, let’s see another example when first value is less than second,

## Example

Live Demo

#include<iostream>
#include<math.h>
using namespace std;
int main() {
int val1 = 5;
int val2 = 8;
bool result;
result = isgreaterequal(val1, val2);
cout << "val1 isgreaterequal than val2 : " << result << endl;
return 0;
}

Here is the output,

## Output

val1 isgreaterequal than val2 : 0