Multiples of 2 and 3

Easy
0/40
10 upvotes
Asked in company
Pinnacle Works Infotech

Problem statement

Find and return the sum of all elements in an array which are either divisible by 2 or by 3.

Detailed explanation ( Input/output format, Notes, Images )
Input Format :
Line 1: N + 1 integers, where 1st integer denotes the size of array N and next N are elements of the array, separated by spaces
Output Format:
A single integer denotes the sum of all those numbers which satisfy the specified condition.
Constraints :
1<= N <=10^5)
Sample Input 1:
4 
3 5 6 7
Sample Output 1:
9
Approaches (1)
Time Complexity
Space Complexity
Code Solution
(100% EXP penalty)
Multiples of 2 and 3
Full screen
Console