Find largest of three numbers in C


 In this program we’ve taken three variables (named – first, second & third) in which values are initialized by the User. A maxvariable is also taken & initially initialized by the value of the variable first.


The logic for finding out the largest of 3 numbers is :

Here are using 2 if loops for comparing the variable. The first loop is used to compare the value of the variable max & second,here if max is smaller than second then the max will becomes equal to second. The another if loop is used to check whether the variable max is smaller than third or not, if yes then max will becomes equal to the value of the third variable. Finally we get out MAXIMUM number which should be stored in the variable max.



Author Description


Our mission is to bring the affordable Technology education to people everywhere, in order to help them achieve their dreams and change the world. - Follow @program_guide

No comments yet.

Join the Conversation