Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ru.koshkina;
- import java.util.Scanner;
- public class Задание3 {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- System.out.print("Введите N: ");
- int n = in.nextInt();
- System.out.print("Введите числа: ");
- int smin = 0;
- int min = 999;
- for(int counter = 0; counter < n; counter++){
- int x = in.nextInt();
- if (x < min) {
- min = x;
- }
- if(x < min && x < smin){
- min = x;
- }else if(x > min && n > x) {
- smin = x;
- }
- }
- System.out.print("Второй минимум: " + smin);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement