#include <stdio.h>
int Second_minimum;
int GetSecondMinimum(int,int,int);
int main(){
int a = scanf("%d",&a);
int b = scanf("%d",&b);
int c = scanf("%d",&c);
int Secondminimum=GetSecondMinimum(a,b,c);
printf("%d",Secondminimum);
}
int GetSecondMinimum(int x,int y,int z){
if(x>y && x<z){
Second_minimum=x;}
else if(x>z && x<y){
Second_minimum=x;}
else if(y>x && y<z){
Second_minimum=y;}
else if(y<x && y>z){
Second_minimum=y;}
else if(z>x && z<y){
Second_minimum=z;}
else if(z<x && z>y){
Second_minimum=z;}
return Second_minimum;
}
The above code is not printing on the basis of user-input.
For example, if I am passing a direct value to the function, it is showing the proper answer.
It is printing 20
if I am passing GetSecondMinimum(20,10,30)
but it is not printing if I am passing parameters this way:
a=20;b=10;c=30;
GetSecondMinimum(a,b,c)