Write a program that prompts the user for positive integers,
only stopping when a negative integer or zero is given. The program
should then print out how many of the positive integers were
odd.
Example:
Enter a positive integer (0 or negative to stop): 9
Enter a positive integer (0 or negative to stop): 4
Enter a positive integer (0 or negative to stop): 7
Enter a positive integer (0 or negative to stop): -3
You entered 2 odd integers.
java languageee!!!!!
//Main2.java
import java.util.Scanner;
public class Main2{
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
int n, count = 0;
while (true) {
System.out.print("Enter a positive integer (0 or negative to stop): ");
n = scanner.nextInt();
if(n<=0){
break;
}
if(n%2 == 1){
count += 1;
}
}
System.out.println("You entered "+count+" odd integers.");
}
}

Enter a positive integer (0 or negative to stop): 9
Enter a positive integer (0 or negative to stop): 4
Enter a positive integer (0 or negative to stop): 7
Enter a positive integer (0 or negative to stop): -3
You entered 2 odd integers.

Write a program that prompts the user for positive integers, only stopping when a negative integer...
C++
Write a program that prompts the user to enter integers or a sentinel to stop. The program prints the highest and lowest numbers entered, the sum and the average. DO NOT USE ARRAYS, only variables and loops. Write a program the prompts the user to input a positive integer. Keep asking the user until a positive integer is entered. Once a positive integer is entered, print a message if the integer is prime or not. (NOTE: A number is...
Write a C++ program that repeatedly collects positive integers from the user, stopping when the user enters a negative number or zero. After that, output the largest positive number entered. A sample run should appear on the screen like the text below. Enter a number: 3 Enter a number: 10 Enter a number: 2 Enter a number: -213 Output: The largest positive number you entered was 10.
Write a c++ complete program to meet the specifications. The program should prompt the user for a positive integer. The program should print a message whether the integer is even or odd. The looping should end when the user enters a negative number. The negative number will not be tested for even or odd. The program will print out a message of how many numbers were entered (not counting the negative number) and how many even and odd numbers were...
A java program Write a program that prompts for and reads in a positive integer into a variable n. Your program should then sum the first n ODD integers and display the sum. For example, if 3 is entered for n, your program should display the the sum 1 + 3 + 5. If 5 is entered, your program should display the sum 1 + 3 + 5 + 7 + 9. What is the...
Write a Java program to prompt for inputting an integer N, then enter N integers (a loop is needed), print the numbers user entered, and the amount of even and odd numbers (zero is even number). (1) Prompt for the user to input an integer and output the integer. (1 pts) Enter an integer: You entered: 5 (2) Prompt for the user to input N integers, output the numbers entered and the amount of even and odd numbers (9 pts)...
In Java
Write a program that will ask the user for integers and print if the integer is positive, negative or zero. The program should continue asking for integer until the user enters a negative value.
Write a program in JAVA that asks the user to enter an integer. Store the integers in an array. Allow for up to 10 integers. When the user enters -1, the program should end. Print the number of integers entered as well as the number of times each integer was entered.
Write a program that prompts the user for a positive integer n and then produces an n × n multiplication table using a nested for loop. You do not have to do any error-checking nor do you need to put row or column labels. Example: Enter a positive integer: 4 1 2 3 4 2 4 6 8 3 6 9 12 4 8 12 16 JAVA CODE!!!!!!!!! (Java language)
Write a program that prompts the user for a positive integer, n, and then prints a following shape of stars using nested for loop, System.out.print(“*”);, and System.out.println();. Example1: Enter a positive integer: 3 * * * * * * * * * Example2: Enter a positive integer: 5 * * * * * * * * * * * * * * * * * * * * * * * * * JAVA LANGUAGE!!
Java: Write a program that prompts the user to enter integers in the range 1 to 50 and counts the occurrences of each integer. The program should also prompt the user for the number of integers that will be entered. As an example, if the user enters 10 integers (10, 20, 10, 30, 40, 49, 20, 10, 25, 10), the program output would be: 10 occurs 4 times 20 occurs 2 times 25 occurs 1 time 30 occurs 1 time...