Pages

Tuesday, 9 June 2015

C program to find largest of two values using relational operator

C program to find largest of two values using relational operator

Coding:

#include<stdio.h>
int main()
{
int a,b;
printf("Please enter two values:");
scanf("%d%d",&a,&b);
if(a>b)
printf("Largest value is=%d",a);
else
printf("Largest value is=%d",b);
return 0;
}

Output:
Please enter two values:10 20
Largest value is=20