public class Questions { public static void main(String[] args) { // TODO Auto-generated method stub int

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

public class Questions { public static void main(String[] args) { // TODO Auto-generated method stub int

Post by answerhappygod »

public class Questions {
public static void main(String[] args){ // TODO Auto-generated methodstub int[] arr = { 7, 6, 4, -1, 3,-4 }; System.out.println(sumNegative(arr, 0)); }
// Number recursion // This method should multiply all the numbersfrom 1 to n. // e.g. productFirstN(5) -> 5*4*3*2*1 =120 public static int productFirstN(int n) { return -10; }
// This method should add all the odd numbersfrom 1 to n. // e.g. productFirstN(11) -> 11 + 9 + 7 + 5 +3 + 1 public static int sumOdds(int n) { return 0; }
// This method should add the square of allnumbers from 1 to n. // e.g. productFirstN(4) -> 4*4 + 3*3 + 2*2 +1*1 public static int sumSquares(int n) {
return 0; }
// This method should return the nth power of10 // e.g. power10(5) -> 10*10*10*10*10 public static int power10(int n) { return -10; }
// Digit recursion // This method should count all odd digits inn // e.g. countOdd(12345) -> 3 public static int countOdd(int n) { return -10; }
public static int prodOdd(int n) { return 0; }
// This method should sum all even digits inn // e.g. sumEven(1234) = 2 + 4 public static int sumEven(int n) { return 0; }
// This method should count all the 7's inthe number n // e.g. countSeven(172737) -> 3 public static int countSeven(int n) { return -10; }
// Arrays recursion // This method should return the sum of allnegative numbers in arr public static int sumNegative(int[] arr, int i){ return -10; }
// This method should return the product ofall numbers in arr which // are greater than min public static int productGreaterThan(int[] arr,int i, int min) { return -10; }
// This method should add 1 to every entrywithin arr public static void plusOne(int[] arr, int i){ return 0; }
}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply