WAP to enter 10 numbers and print the sum of
odd numubens and product of even numbers
Answers
Answered by
1
Answer:
They are 1,3,5,7,9,11,13,15,17,19 and so on. Now, we need to find the sum of these numbers. Below is the table for the sum of odd numbers.
Step-by-step explanation:
mark me as brainliest
Answered by
1
Step-by-step explanation:
class a
{
public static void main (String args[])
{
int s=0,p=1;
Scanner sc=new Scanner(System.in);
for(int i=1;i<=10;i++)
{
System.out.println("enter");
int j=sc.nextInt()
if(j%2!=0)
s=s+j;
else
p=p*j;
}
System.out.println("odd sum"+s);
System.out.println("even product"+p);
}
}
Similar questions
English,
1 month ago
English,
4 months ago
Social Sciences,
10 months ago
Math,
10 months ago
Hindi,
10 months ago