Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- int a = 0;
- System.out.println("Введите колиество чисел в массиве: ");
- Scanner sc = new Scanner(System.in);
- int n = sc.nextInt();
- int[] num = new int[n];
- for (int i = 0; i < n; i++) {
- System.out.printf("Введите число массива под номером %d: ", i);
- num[i] = sc.nextInt();
- }
- for (int j = 1; j < n; j++) {
- if (num[j] > num[j-1]) {
- a = a + 1;
- }
- }
- System.out.printf("Чисел получилось: %d", a);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment