Home
(current)
About
Tutorial
Technologies
C#
Deep Learning
Statistics for AIML
Natural Language Processing
Machine Learning
SQL -Structured Query Language
Python
Ethical Hacking
Placement Preparation
Quantitative Aptitude
View All Tutorial
Quiz
C#
SQL -Structured Query Language
Quantitative Aptitude
Java
View All Quiz Course
Q & A
C#
Quantitative Aptitude
Java
View All Q & A course
Programs
Articles
Identity And Access Management
Artificial Intelligence & Machine Learning Project
How to publish your local website on github pages with a custom domain name?
How to download and install Xampp on Window Operating System ?
How To Download And Install MySql Workbench
How to install Pycharm ?
How to install Python ?
How to download and install Visual Studio IDE taking an example of C# (C Sharp)
View All Post
Tools
Program Compiler
Sql Compiler
Replace Multiple Text
Meta Data From Multiple Url
Contact
User
Login
Register
FRESHER BELL ALL LANGUAGE ONLINE COMPILER
Write a java program to find summation of even numbers in the array
Languages
Java
C
C-99
C++
C++ 14
C++ 17
PHP
Perl
Python 2
Python 3
Ruby
Go Lang
Scala
Bash Shell
SQL
Pascal
C#
VB.NET
Haskell
Objective C
Swift
Groovy
Fortran
Brainf**k
Lua
TCL
Hack
Rust
D
Ada
R Language
Free Basic
Theme
github
xcode
ambiance
monokai
chaos
chrome
Program
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); System.out.println("Enter array size"); int n=sc.nextInt(); if(n>=10 || n<1) { System.out.println(n+" is an invalid input"); Runtime.getRuntime().halt(0); } int arr1[]=new int[n]; int arr2[]=new int[n]; int result[]=new int[n]; System.out.println("Enter array elements in 1st array"); for(int i=0;i<n;i++) { arr1[i]=sc.nextInt(); } System.out.println("Enter array elements in 2nd array"); for(int i=0;i<n;i++) { arr2[i]=sc.nextInt(); } //PROGRAM LOGIC int count=0; for(int i=0;i<n;i++) { if((arr1[i]%2==0 || arr1[i]==0) && (arr2[i]%2==0 || arr2[i]==0)) { result[i]=arr1[i]+arr2[i]; count++; } else { result[i]=0; } } if(count==0) { System.out.println("No even number is present in an Array"); } for(int i=0;i<n;i++) { System.out.println(result[i]); } } }
Run
Clear
Input
4 2 4 6 8 1 2 5 2
Output
Powered By Fresher Bell™
Similar Program
#
Program
Language
1
Java program to find the reverse of user input
Java
2
Java For Loop Example
Java
3
Write a program if length of string is even, the reverse the string: MIDDLE LETTER/Reverse first half of the string if string length is ODD
Java
4
Write a java program to find alternate sum and difference of a given number
Java
5
Write a program to find the operator between number
Java
6
Java program to find transpose of matrix
Java
7
Java if else if ladder Example
Java
8
Write a java program to determine whether a given number is a Harshad number
Java
9
Write a java program to calculate product of count of uppercase and lowercase letters
Java
10
Java program to find GCD or HCF of two number taken by user using for loop
Java
11
Java program to check whether a given number is even or odd
Java
12
Alternate Method 2 :Write a program to find anagram or two words of same letter
Java
13
Java program to find the element in the array
Java
14
Write a java program to find unique character in string
Java
15
Java program to generate right angled triangle or half pyramid using number and for loop - 2
Java
16
Java program to show factor of a user input
Java
17
Write a program to find time using battery capacity and changing current value
Java
18
Java program to find the ASCII value of a input taken from user
Java
19
Java Ternary Operator Example
Java
20
Java program to convert String to Character Array
Java
#
Program
Language
Copyright © 2020
Inovatik
- All rights reserved