Computer Science, asked by Sanskarsingh6681, 1 year ago

Write a program in java to find second smallest number .No should enter by the user

Answers

Answered by brainiac47
0
package class SecondSmallestNumber{ int[] x ={10,11,12,13,14,6,3,-1};         int small=x[0];  for(int i=0;i<x.length;i++) {        if(x[i]<small)        {        small=x[i];        } }    int sec_Small=x[0]; for(int i=0;i<x.length;i++) {        if(x[i]<sec_Small && x[i]!=small)        {        sec_Small=x[i];        }  }         System.out.println("Second Smallest Number: "sec_Small);        }}


Similar questions