Last active
April 4, 2019 19:13
-
-
Save anonur/39f647acfa7bc24a805a456d3ddad333 to your computer and use it in GitHub Desktop.
Compare two numbers with if
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| int main(void) | |
| { | |
| int num1; | |
| int num2; | |
| printf("Enter two integers, and I will tell you\n"); | |
| printf("the relationships they satisfy: "); | |
| scanf("%d %d", &num1,&num2); | |
| if(num1 == num2) { | |
| printf("%d is equal to %d\n", num1, num2); | |
| }//end if | |
| if(num1 != num2) { | |
| printf("%d is not equal to %d\n",num1, num2); | |
| }//end if | |
| if(num1 < num2) { | |
| printf("%d is less than %d\n",num1, num2); | |
| }//end if | |
| if(num1 > num2) { | |
| printf("%d is greater than %d\n",num1, num2); | |
| }//end if | |
| if(num1 <= num2) { | |
| printf("%d is less than or equal to %d\n",num1, num2); | |
| }//end if | |
| if(num1 >= num2) { | |
| printf("%d is greater than or equal to %d\n",num1, num2); | |
| }//end if | |
| return 0; | |
| }//end function main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment