codescracker


c

C Program to Find Largest of Two Numbers



« Previous Program Next Program »


Find Largest of Two Numbers in C

To find the largest or greatest number between/of the two number in C programming, you have to ask to the user to enter the two number to start checking which one is larger to display the largest number

C Programming Code to Find Largest of Two Numbers

Following C program ask to the user to enter the two number, to find the greatest or largest of the two number, then display the result on the screen:

/* C Program - Find Largest of Two Numbers */
		
#include<stdio.h>
#include<conio.h>
void main()
{
	clrscr();
	int a, b, big;
	printf("Enter two number : ");
	scanf("%d%d",&a,&b);
	if(a>b)
	{
		big=a;
	}
	else
	{
		big=b;
	}
	printf("Biggest of the two number is %d",big);
	getch();
}

When the above c program is compile and executed, it will produce the following result. Above C Programming Example Output (for b):

c program find largest of two numbers

Above C Programming Example Output (for a):

c program find greatest of two numbers

Same Program in Other Programming Language

You may also like same program in other programming languages:


« Previous Program Next Program »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test