Relationship Between Two Numbers

Wednesday, 1 May 2013

We all know that numbers are simple yet complex figures. First thing we understand about numbers is that  they differ from one another when it comes to equality. Every numbers like letters, when combined together they form another kind of figures which may be larger than the other numbers, smaller, they may also be equal or not equal.

Since kindergarten, we are taught how to determine the relationship between two integers/numbers, if it is equal to or not equal to than the other number. So I made a program that is used to determine the relationship between two integers/numbers easily. The program that is shown below is more faster in figuring out the relationship and more useful when teaching your younger ones. Check out the codes below.



#include<stdio.h>
#include<conio.h>

main()
{
 int var1, var2;
 printf("Enter two numbers and I will tell you \n the relationships they satisfy: ");
 scanf("%d%d", &var1, &var2);

 if(var1==var2)
   printf("%d is equal to %d\n", var1, var2);
 else
   printf("%d is not equal to %d\n", var1, var2);  

 getch();    
}


The program runs a like these, first it will ask you to enter two integers/numbers then variables 1 and 2, in which your input is stored, will go through the if else statement. If your input will not satisfy the if statement argument then it will automatically jump to the else statement and the output will show. If it will satisfy the if statement then the output will show immediately, it will not proceed to the else statement. Then the program terminates. Check out the sample output below.





Hope you learned something. Feel free to leave a comment below. Thanks!

No comments:

Post a Comment

Please do leave a comment. It's gonna be a friendly conversation between programmers. Hope you do find our blog helpful. Thank you!

Related Posts Plugin for WordPress, Blogger...