CoCubes Coding Question – Second largest Number

Second largest Number: CoCubes Coding Question

1.  PROBLEM STATEMENT:
You are given a function,
int  FindSecondLargestNumber(int a,int b,int c);
The function takes three integers ‘a’, ‘b’,’c’ as input .Implement the function to find and return the second largest number.
CODING:
int FindSeconLargestNumber(int a,int b,int c);

}Answer:
#include <stdio.h>

int main()

{
int a,b,c,lar,seclar;

scanf(“%d%d%d”,&a,&b,&c);

if(a>b)
{
if(a>c)
lar=a;
else
seclar=a;
}

if(b>c)
{
if(b>a)
lar=a;
else
seclar=b;
}
if(c>a)
{
if(c>b)
lar=c;
else
seclar=c;
}
printf(“second largest number :%d”,seclar);

}