Write a program to accept 10 numbers. Find the sum of all numbers which are the even numbers. (Non-anonymous question).
plz ans fast
Answers
Answered by
1
Answer:
Assuming it is java program.....
import java.util.*;
class Sum
{
public static void main (String ar[])
{
Scanner sc=new Scanner (System.in);
int i,n,s=0;
for(i=1;i<=10;i++)
{
System.out.println("Enter a no.");
n=sc.nextInt();
if (n%2==0)
s+=n;
}
System.out.println("Sum of even no's: "+s);
}
}
Hope My Answer Helps u.....Mark me Brainliest...
Similar questions