The following table lists C mathematical comparison operators.

Operator | Example | True When |
---|---|---|

!= | a != b | a is not equal to b |

< | a < b | a is less than b |

<= | a <= b | a is less than or equal to b |

== | a == b | a is equal to b |

> | a > b | a is greater than b |

>= | a >= b | a is greater than or equal to b |

Comparisons in C work from left to right.

#include <stdio.h> int main() /*from w w w . jav a 2 s.c o m*/ { int first,second; printf("Input the first value: "); scanf("%d",&first); printf("Input the second value: "); scanf("%d",&second); puts("Evaluating..."); if(first<second) { printf("%d is less than %d\n",first,second); } if(first>second) { printf("%d is greater than %d\n",first,second); } return(0); }