#include <stdio.h>
int main(void) {
// your code goes here
int a,b,c,t;
scanf("%d",&t);
for(int i=0;i<t;i++)
{
scanf("%d%d%d",&a,&b,&c);
if(a>b && b>c)
printf("%d is the second largest no",b);
if(b>a && a>c)
printf("%d is the second largest no",a);
if(b>c && c>a)
printf("%d is the second largest no",c);
if(a>c && c>b)
printf("%d is the second largest no",c);
if(c>b && b>a)
printf("%d is the second largest no",b);
if(c>a && a>b)
printf("%d is the second largest no",a);
}
return 0;
}
Mine code is writen above dont understand error, while submiting getting error
Not sure if error in code or in coder.
mine written code is correct or not? @bishen28
what error are you getting?
dont write anything in print statements just write : printf("%d\n",b); where b is second largest.
2 Likes
#include <stdio.h>
int main(void) {
// your code goes here
int a,b,c,t;
scanf("%d",&t);
for(int i=0;i<t;i++)
{
scanf("%d%d%d",&a,&b,&c);
if(a>b && b>c)
printf("%d\n",b);
if(b>a && a>c)
printf("%d\n",a);
if(b>c && c>a)
printf("%d\n",c);
if(a>c && c>b)
printf("%d\n",c);
if(c>b && b>a)
printf("%d\n",b);
if(c>a && a>b)
printf("%d\n",a);
}
return 0;
}
Your program would look like this
@muskan94 i did’n get any error, i run your code on codechef IDE.
it is fine.
thank you i got it @zub12_4