Write a program to calculate the amount that will result from the doubling to understand which choice results in a larger amount.
Answers
Answered by
4
Answer:
Given an array and an integer k, traverse the array and if the element in array is k, double the value of k and continue traversal. In the end return value of k.
Examples:
Input : arr[] = { 2, 3, 4, 10, 8, 1 }, k = 2
Output :16
First k = 2 is found, then we search for 4
which is also found, then we search for 8
which is also found, then we search for 16.
Input : arr[] = { 2, 4, 5, 6, 7 }, k = 3
Output :3
Similar questions
Science,
2 months ago
English,
2 months ago
World Languages,
2 months ago
History,
4 months ago
Computer Science,
4 months ago
Math,
9 months ago
Hindi,
9 months ago
Math,
9 months ago