Skip to content

Latest commit

 

History

History
33 lines (27 loc) · 1.74 KB

README.md

File metadata and controls

33 lines (27 loc) · 1.74 KB

Iteration-Problems

Beginners Problems on Iterations

Starters

Check Password: Write a program for the user to continue inputting a password with the prompt “Enter Password: “. Only end the program once the user inputs the correct password, and give a corresponding message saying “Correct Password”. Update your program to only have the user guess 3 times before they’re banned from logging in, to which you output “Locked” (because they should give up at this point).

Name Loop: Write a program for the user to input an integer and then ask what their name is (with corresponding prompts). You should print their name to the console for the user input number of times. This is what the console should display. Input is in blue. Enter a number: 3 Enter your name: Julia Julia Julia Julia (These are all on their own lines)

Multiplication

Write a program that allows the user to input a positive integer and print the multiplication table of that number (do it so that if the user does not, print a corresponding message to make the user enter a positive integer).

E.g. (How the code should run should a negative integer be given) Enter a positive integer: -1 Not a positive integer. Enter a positive integer:

Prime Number

Write a program that allows the user to input an integer. Output a corresponding message to tell the user whether or not that integer is a prime number or not.

FizzBuzz

This is a traditional children’s game wherein you count upwards (starting from 1) and every time there is a multiple of 3 you say Fizz and every time there is a multiple of 5 you say Buzz. Every time there is a multiple of both 3 and 5 you say FizzBuzz. Create a simulation of this game, where you count from 1 to 100. Hint: Use the Modulo Operator.