1. [2] Write a program that asks the user for a positive integer, then outputs all the numbersfrom 1 to that number. 2. [2] Write a program that asks the user for a number and prints out that many...

1. [2] Write a program that asks the user for a positive integer, then outputs all the numbersfrom 1 to that number.
2. [2] Write a program that asks the user for a number and prints out that many stars ona line. Continue asking the user for new numbers until they decide not to.
3. [3] Write a program that asks the user for a number, and then outputs all the factors ofthe number.
4. [3] Write a program that asks the user for a number, and then outputs a pyramid of ‘*’swhose largest layer is the entered number.
5. [2] Write a program that asks the user for a number, then outputs an offset pyramid ofstars with that many layers.Note: you may not use CSS to create the centring effect.
Note** This is for a middle school programming course so please make the solution as basci as possible. We've covered while loops and this assignment is for that lesson. Please use while loops for every questions. For inputs, please get the input from an input box in the page itself, no prompt boxes or confirmation boxes please.



while Loop Challenges Name: /12 Programs For the questions in this section, upload the program, including an appropriate name, to Google Classroom. Note that no data sanitation is required for these programs, although each one should be completed in a separate file. 1. [2] Write a program that asks the user for a positive integer, then outputs all the numbers from 1 to that number. E.g. 1 Please enter a number: 5 2 1 3 2 4 3 5 4 6 5 2. [2] Write a program that asks the user for a number and prints out that many stars on a line. Continue asking the user for new numbers until they decide not to. E.g. 1 Please enter a number: 4 2 **** 3 Do you want to try again? (y/n) y 4 Please enter a number: 7 5 ******* 6 Do you want to try again? (y/n) n 7 Goodbye! Hint: you can use the .repeat(n) function to repeat a string n times. Although you don’t need it to complete this question, it may prove useful! 3. [3] Write a program that asks the user for a number, and then outputs all the factors of the number. E.g. 1 Please enter a number: 18 2 Factors are 1 2 3 6 9 18 4. [3] Write a program that asks the user for a number, and then outputs a pyramid of ‘*’s whose largest layer is the entered number. E.g. 1 Please enter a number: 4 2 * 3 ** 4 *** 5 **** Rev. 2020/05/01 15:28:58 -06’00’ while Loop Challenges 5. [2] Write a program that asks the user for a number, then outputs an offset pyramid of stars with that many layers. E.g. 1 Please enter a number: 4 2 * 3 *** 4 ***** 5 ******* Note: you may not use CSS to create the centring effect. Programming 9 2 CSE1120: Structured Programming 2
May 01, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here