write a program to input 10 integers and find the sum of even integers only
Answers
Answered by
1
import Java. so. *;
Class p;
/*curly braces
public static void main(String args())throws Exception
/*curly braces
DataInputStream in=DataInputStream(System.in);
int a()=new int(10)
int I, s=0;
for(i=0;i<10;i++)
/*curly braces
sopln("enter the number ");
a=Ip;
/*curly braces closed.
for (i=0;i<9;i++)
/*curly braces
if(a(i)%2==0)
s=s+a(i);
/*curly braces closed
Sopln("the sum of even numbers is "+s) ;
/*curly braces closed main
/*curly braces closed class
Sopln:System.out.println
IP.:Integer. pardeInt(in.readline());
/*curly braces closed because my keypad don't have curly braces and square braces....
HOPE IT HELPS.... (。’▽’。)♡
Class p;
/*curly braces
public static void main(String args())throws Exception
/*curly braces
DataInputStream in=DataInputStream(System.in);
int a()=new int(10)
int I, s=0;
for(i=0;i<10;i++)
/*curly braces
sopln("enter the number ");
a=Ip;
/*curly braces closed.
for (i=0;i<9;i++)
/*curly braces
if(a(i)%2==0)
s=s+a(i);
/*curly braces closed
Sopln("the sum of even numbers is "+s) ;
/*curly braces closed main
/*curly braces closed class
Sopln:System.out.println
IP.:Integer. pardeInt(in.readline());
/*curly braces closed because my keypad don't have curly braces and square braces....
HOPE IT HELPS.... (。’▽’。)♡
Answered by
2
Question:
Write a program to input 10 integers and find the sum of even integers only.
Solution:
Language used: Java
----------------------------------------------------------------------------------
import java.util.*;
public class Question10
{
static void main()
{
Scanner sc=new Scanner(System.in);
int i,n,s=0;
System.out.println("Enter 10 integers:");
for(i=1;i<=10;i++)
{
n=sc.nextInt();
if(n%2==0)
s=s+n;
}
System.out.print("Sum of even numbers="+s);
}
}
Similar questions