Comparing two integer variables is one of the simplest programs you can write at ease. In this program, you can either take input from user using scanf()
function or statically define in the program itself.
We expect it to be a simple program for you as well. We are just comparing two integer variables.
/*To evaluate greater or lesser numbers*/
#include<math.h>
#include<stdio.h>
int main()
{
float x, y;
printf("Enter the value of x:");
scanf("%f", &x);
printf("Enter the value of y:");
scanf("%f", &y);
#include<math.h>
#include<stdio.h>
int main()
{
float x, y;
printf("Enter the value of x:");
scanf("%f", &x);
printf("Enter the value of y:");
scanf("%f", &y);
if(x==y)
printed("x is equal to y\n");
elseif(x>y)
printf("x is greater than y\n");
else
printf("y is greater than x\n");
return(0);
}
elseif(x>y)
printf("x is greater than y\n");
else
printf("y is greater than x\n");
return(0);
}
Output:
Comments
Post a Comment