# Find largest number from user input in c programming

## Find the largest number:

The logic of finding a large number is so easy.
We have to declare some variables and just compare them with each other.
For example, we have 3 number to compare and we have to find the biggest number from them. The logic of comparing 3 number and find the biggest one is pretty simple.
Think, we have number 5, 15 and 10. So we can first compare the first two number with a condition like, is (5 > 15)? If this condition is true, then we will take 5 as the bigger number. But here the condition is not true.
5 is not bigger than 15. So there will be other condition like:

if (5>15){
//pick 5 as big number
}
else{
//15 is big number
}

We have found a big number from the first two number. Now time to compare the third number with our founded number.

Now again the condition is

if(15>10){
//15 is the big number
}
else{
//10 is the big number
}

Here we have compared the first two number and then compare the third number with the biggest number between the first two number.
If we put our values into the integer type variable like:

int a = 5;
int b = 15;
int c = 10;

Then the full code looks like:

I hope the basic logic is now clear to find largest number among three integer.

Now if we want to check different 3 number from user input, we just need to take input from user. For this, we have to use scanf function.

If we want to input the value of int a from user, we have to use scanf ("%d",&a);
We also can ask user to give the input by following:

int a, b, c;
printf ("input a : ");
scanf ("%d",&a);
printf ("input b : ");
scanf ("%d",&b);
printf ("input c : ");
scanf ("%d",&c);

Now, the complete code will looks like:

If you have any more question about Finding largest number from user input in c programming, please comment bellow.

Happy Coding

#### How to print Stars pattern in CHow to print Stars pattern in java

Find largest number from user input in c programming. The logic of finding large number is so easy. We have to declare some variables and just compare them with each other. Find largest number from user input in c programming.