42 : C Program to Find Greatest among 3 numbers

Check out the complete list of c-programs : C Program List    

Find the Greatest number among the 3 entered numbers.

Variables :

n1,n2 and n3 : Datatype int : Holds value of number1, number2 and number3 inputted by the user.

max_no : Datatype int : To hold the max values.

 * 1000+ C programs + tutorials
 * 37_find_greatest_number_among_3.c
 *  Created on: Oct 20, 2014
 *  Author: Code2care.org


void main() {

   int n1,n2,n3;
   int max_no;

//    clrscr();

    printf("C Program to Find Greatest Number amound 3 Entered Number");

    printf("\n\n Enter Number 1: ");
    scanf("%i", &n1);
    printf("\n\n Enter Number 2: ");
    scanf("%i", &n2);
     printf("\n\n Enter Number 3: ");
    scanf("%i", &n3);

   //Logic to find Greatest Number
  max_no = n1;
  (max_no < n2) && (max_no = n2); 
  (max_no < n3) && (max_no = n3);
   printf("\n\n Greatest among Numbers %i,%i and %i : %i",n1,n2,n3, max_no);

//	getch();


The best way to learn C programming is to practice more and more of programs . Code2care C Programming tutorials provide 1000+ programs in C that you can study and become an expert in the language. Programs are divided into categories depending upon type and complexity.

BSc. IT, BSc. Computer Science, BSc. IT, MSc. IT, MSc. Computer Science, MCA, BTech IT & BTech Engineers may find these programs very useful.