Answered step by step
Verified Expert Solution
Question
1 Approved Answer
7. Write a program that prompts the user for a positive integer n between 10 and 100 and then prints the sum of the
7. Write a program that prompts the user for a positive integer n between 10 and 100 and then prints the sum of the integers that are evenly divisible by 4 or 6, but not both, from 1 to n. Input validation is required. See the example below. Remember to include everything that is needed such as imports, classes, and the main method. Enter a positive integer between 10 and 100: 5 The number you entered is invalid. Try again. Enter a positive integer between 10 and 100: 20 The sum is 72. 8. Write a program that prompts the user to enter 3 integers and then prints the current average, displayed to 2 decimal places, of the numbers that were inputted at that time for each user input using a loop statement. Input validation is not required. See the example below. Remember to include everything that is needed such as imports, classes, and the main method. Hint: Use printf("%.2f", num) to display num to 2 decimal places. Enter an integer number: 5 After 1 number(s), the average is 5.00. Enter an integer number: 6 After 2 number(s), the average is 5.50. Enter an integer number: 10 After 3 number(s), the average is 7.00.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started