
Write a sub that requests a positive integer with an InputBox. Then use a For loop to sum up all the odd integers up to the input number [e.g. if the user enters 8, the
Hints
- Clear the contents of the worksheet to delete numbers from any previous run. To do this, use: Range(“A1”).EntireColumn.Clear
- Your For loop will need Step 2 so that it loops through 1, 3, 5, … etc. instead of the usual 1, 2, 3, …
- Clear out your accumulator (Total) at the beginning
- You would need an integer variable, say Row, to keep track of where you want to write the next number on the sheet. You can then write to the sheet by using: Range(“A1”).Offset(Row,0).Value
Every time you go through the loop you must update Row (after writing) by using: Row = Row + 1
Then, once you exit the loop, Row will also indicate where you should write the Total.
Your sheet would look like this (for an input number of 20):


Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 3 images

- In java, create a program that will use a do while loop with a "yes/no" prompt. The program should include user input and output with getters and setters. Once the end of the loop is reached, ask the user if they'd like to do the program again. Answering "Yes" will start the program over again. Answering "No" will end the program. Answering with anything else will be an invalid input. Once the loop begins again, the program should also discard all previous inputs so that there won't be any overlapping. Use Scanner.nextLine();, it will help.arrow_forwardAnswer in Java pleasearrow_forwardOutput integer's digits Given an input positive integer, output each digit on its own line, starting with the rightmost digit. Ex: If the input is 935, the output is: 5 3 9 Hints: Use the mod operator (%) to get the rightmost digit. Mod by 10 to get the rightmost digit. Use a loop that keeps a current dividend (the number being divided). In each iteration, output the rightmost digit, then update the divisor by dividing by 10. End the loop when the divisor is 0. in javaarrow_forward
- Write a program with the most appropriate loop that repeats user entered number of times (say the variable counts holds that number), asking the user counts times to enter numbers. The loop should also calculate the sum and the average of the numbers entered. Be sure to include the following: A class header with an appropriately named class. A main method. Use Scanner class for keyboard input. Declare and initialize any necessary variables. Use appropriate loop statement. Display any necessary input prompt and the output.arrow_forwardYour task: The maximum of the absolute values. For instance, if the numbers entered are [1, -7, -1, -3, 6, -2, 0], then the printed result must be 7.arrow_forwardI need some help writting a Looping the subject is " My summer vacation"arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





