Write a Java program that reads from the user an integer N followed by N integers. The program then prints the product of odd integers, and, the sum of even integers.
1
Expert's answer
2012-10-16T11:41:12-0400
import java.util.Scanner;
public class main {
public static void main(String[] args) { Scanner sc = new Scanner(System.in);
System.out.println("Enter number of integers"); int N = sc.nextInt(); int[] arr=new int[N];
System.out.println("Enter "+N+" numbers"); for (int i = 0; i < arr.length; i++) { arr[i]=sc.nextInt(); }
int prodOfOddInt=1; int SummOfEvenInt=0; for (int i = 0; i < arr.length; i++)
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment