adsense

Hii, welcome to my site. My name is Om prakash kartik. This blog helps you to learn programming languages concepts.

Program in C to find the second largest number among three numbers

Program in C to find the second largest number among three numbers


#include<stdio.h>
#include<conio.h>
 void main()
  {
     int a,b,c;
     printf("Enter three no.:-");
      scanf("%d%d%d",&a,&b,&c);
     if(a>b&&a>c)
     {
        if(b>c)
          printf("%d is second greater.",b);
         else
           printf("%d is second greater",c);
      }
     if(b>a&&b>c)
       {
         if(a>c)
           printf("%d is second greater",a);
      else
       printf("%d is second greater",c);
     }
     if(c>a&&c>b)
        {
         if(a>b)
           printf("%d is second greater",a);
         else
           printf("%d is second greater",b);
     }
    getch();
 }
Output:-









Related program

  1. Program in C and C++ to find the second largest element in an array of n elements

Post a Comment

0 Comments