c program to find the largest of three numbers

c program to find the largest of three numbers. This basic c program, makes use of concept of if-else conditional cases, and makes us comfortable with how ‘and’ (“&&”) operator is used. Here is the c program:

c program to find the largest of three numbers

#include<stdio.h>
#include<conio.h>

int main() 
{
    int a, b, c;
    printf("Enter first number "); 
    scanf("%d",&a); 
    printf("\nEnter second number ");
    scanf("%d",&b);   
    printf("\nEnter third number ");
    scanf("%d",&c);
 
   if(a>b && a>c)
   printf("\n%d is the greatest number ",a);
   else if(b>c)
   printf("\n%d is the greatest number ",b);
   else
   printf("\n%d is the greatest number ",c);

   getch();
 }

Output : 

c program to find the largest of three numbers



Add Comment Register



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>