the link of problem : MAXREM Problem - CodeChef
and here is my code :
#include<stdio.h>
/// the link of explanation :Find Second largest element in an array - GeeksforGeeks
int main(){
int t,a=0,b=0;
scanf(“%i”,&t);
while(t–){
int n;
scanf(“%i”,&n);
if(n>a){
b=a;
a=n;
}
else if(n>b && b!=a) b=n;
}
printf(“%i\n”,b%a);
}