30. To print all odd numbers from 1 through 49, one next to the other with a space in between. 31. To print 30 times the word good on the screen one below the other. 32. To compute the sum of the series: $1 + 3 + 5 + 7 + \dots + 99$. 33. To store the numbers 9, 15, 4, 18, and 7 in an array. 34. Write a method named calcPsums that receives an integer array as a parameter and finds the sum of the positive integers in the array and returns the sum.
Added by Elisa S.
Close
Step 1
...+99. To find the sum of an arithmetic series, we can use the formula: Sum = (n/2)(first term + last term) In this case, the first term is 1, the last term is 99, and the common difference is 2. So, the sum of the series is: Sum = (99/2)(1 + 99) = Show more…
Show all steps
Your feedback will help us improve your experience
Rabeya Zahid and 73 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Write a Java program to compute the sum of the digits of an integer. Input Data: Input an integer: 25 Expected Output: The sum of the digits is: 7
Willis J.
Question: Write a Java program to calculate the sum and average value of array elements.
Sanchit J.
Write a short Java method that takes an integer $n$ and returns the sum of all positive integers less than or equal to $n$.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Watch the video solution with this free unlock.
EMAIL
PASSWORD