Sunday, August 15, 2021

Number equal or not, greater of two numbers in C

Write a program to find equal or not

#include<stdio.h>

int main()
{
int x,y;
printf("enter the value of x and y");
scanf("%d %d",&x,&y);
if(x==y)  //Relational operator
{
printf("x and y are equal");
}
else
{
printf("x and y are not equal"); }
return 0;
}

 OUTPUT             

enter the value of x and y
8
8
x and y are equal

Write a program to find greater of two number


#include<stdio.h>

int main()
{
int x, y;
printf("enter the value of x and y");
scanf("%d %d",&x,&y);
if(x>y) //Relational operator
{
printf("x is greater");
}
else
{
printf("y is greater");
}
return 0;
}

NOTE:- // this sign is used for comment. This is not show in output

 OUTPUT

enter the value of x and y
5
8
y is greater

No comments:

Post a Comment