With c programming and without pointer and function You are given an array of N positive integers. Find the maximum even values from the array. For finding the maximum even values from the array you can perform only one of the following operations. Choose any even value from the array. Choose any two(must be different) values from the array and perform summation on those two values. If it will even you can pick those two values. It is guaranteed that all the integers are distinct and at least one operation will exist in the given input. Input Format The first line contains a single positive integer N. The second line will contain N positive integers A1,A2,A3,A4…..An Constraints 1 <= N <= 10 1 <= A[i] <= 20 where (0 <= i < n) Output Format Print a single positive integer, the maximum even value. Sample Input 0 52 4 6 8 10 Sample Output 0 18 Explanation 0 In this case, we can choose 8 and 10, the summation is 18 which is the maximum even. Sample Input 1 52 9 4 1 3 Sample Output 1 12 Explanation 1 In this case we can choose 9 and 3, the summation is 12, which is the maximum even here.
With c programming and without pointer and function You are given an array of N positive integers. Find the maximum even values from the array. For finding the maximum even values from the array you can perform only one of the following operations. Choose any even value from the array. Choose any two(must be different) values from the array and perform summation on those two values. If it will even you can pick those two values. It is guaranteed that all the integers are distinct and at least one operation will exist in the given input. Input Format The first line contains a single positive integer N. The second line will contain N positive integers A1,A2,A3,A4…..An Constraints 1 <= N <= 10 1 <= A[i] <= 20 where (0 <= i < n) Output Format Print a single positive integer, the maximum even value. Sample Input 0 52 4 6 8 10 Sample Output 0 18 Explanation 0 In this case, we can choose 8 and 10, the summation is 18 which is the maximum even. Sample Input 1 52 9 4 1 3 Sample Output 1 12 Explanation 1 In this case we can choose 9 and 3, the summation is 12, which is the maximum even here.
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 23PE
Related questions
Question
With c programming and without pointer and function
You are given an array of N positive integers. Find the maximum even values from the array. For finding the maximum even values from the array you can perform only one of the following operations.
- Choose any even value from the array.
- Choose any two(must be different) values from the array and perform summation on those two values. If it will even you can pick those two values.
It is guaranteed that all the integers are distinct and at least one operation will exist in the given input.
Input Format
- The first line contains a single positive integer N.
- The second line will contain N positive integers A1,A2,A3,A4…..An
Constraints
- 1 <= N <= 10
- 1 <= A[i] <= 20 where (0 <= i < n)
Output Format
- Print a single positive integer, the maximum even value.
Sample Input 0
52 4 6 8 10
Sample Output 0
18
Explanation 0
In this case, we can choose 8 and 10, the summation is 18 which is the maximum even.
Sample Input 1
52 9 4 1 3
Sample Output 1
12
Explanation 1
In this case we can choose 9 and 3, the summation is 12, which is the maximum even here.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L