Computer Science, asked by Nightmare8063, 18 days ago

write a program in java to take 10 numbers in an array and check weather all the numbers are positive or not

Answers

Answered by poojashukla1911
0

Answer:

import java.util.Scanner;

public class KboatSDANumbers

{

public static void main(String args[]) {

Scanner in = new Scanner(System.in);

int arr[] = new int[10];

System.out.println("Enter 10 numbers");

for (int i = 0; i < arr.length; i++) {

arr[i] = in.nextInt();

}

for (int i = 0; i < arr.length; i++) {

if (arr[i] < 0)

System.out.print(arr[i] + ", ");

}

for (int i = 0; i < arr.length; i++) {

if (arr[i] >= 0)

System.out.print(arr[i] + ", ");

}

}

}

Explanation:

mark me as brilliant please

Answered by jeevanjoshyjose
0

There is an array contains some non-negative integers. Check whether the array is perfect or not. An array is called perfect if it is first strictly increasing, then constant and finally strictly decreasing. Any of the three parts can be empty.

Similar questions