Thursday, 23 July 2015

C Program - To find the maximum of two values

C program to find the maximum of two variables


#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("\nEnter the value for a :- ");
scanf("%d",&a);
printf("\nEnter the value for b :- ");
scanf("%d",&b);
if(a>b)
{
printf("\na is greater than b");
}
else
{
printf("\nb is greater than a");
}
getch();
}

Output :-


Enter the value for a :- 10 
Enter the value for b :- 20

b is greater than a

Back to 'C Language Programs'

No comments:

Post a Comment