0
Here is a code. Copy and paste it on a compiler to check if it works for you. #include <stdio.h> //trying to code a program to print the 2nd smallest value (if 2 values are same then both are smallest and the smallest number from the input greater than them is the 2nd smallesg number) int main() { int n,i,j,t; scanf("%d",&n); int a[n],b[n]; for(i=0;i<n;i++) { scanf("%d",&a[i]); } for(i=0;i<n;i++) for(j=i+1;j<n;j++) { if(a[i]>a[j]) { t=a[i]; a[i]=a[j]; a[j]=t; } } for(i=1;i<n;i++) {if(a[i]!=a[0])//if 2 values are same, then the program will skip to the next value { printf("%d", a[i]); return 0; }} printf("All the values are same. There is no 2nd smallest number.\n"); return 0; } I didn't give you the code from code playground because this program runs on my compiler but not on SoloLearn's code playground
5th Dec 2017, 6:59 PM
1604064_Sharif
1604064_Sharif - avatar
0
Alright, here is the code. Hope it works. https://code.sololearn.com/c8ioyKvlHUwQ/?ref=app
6th Dec 2017, 1:05 PM
1604064_Sharif
1604064_Sharif - avatar