enter q number and print the sum of all even digit and product of odd digit
Answers
Answered by
1
Answer:
import java.util.*;
public class answer
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
int q,p,n ,ev =0,odd=1;
System.out.println("Enter the value of q")
q=in.nextInt();
System.out.println("Enter the numbers");
for(p=1;p<=q;p++)
{
n=in.nextInt();
if(n%2==0)
{
ev=ev+n;
}
else
{
odd=odd*n;
}
System.out.println("sum of even numbers"+ev);
System.out.println("product of odd numbers"+odd);
}
}
Explanation: THE ABOVE PROGRAM IS IN JAVA RUN IT ON BLUEJ PLATFORM
Similar questions