#1 Name Use a loop to write your name ten times #7 Namecount Redo #1 but every time you print your name out also print out the value of the loop counter(for example the first three lines might look like this) do this ten times Patti K 0 Patti K 1 Patti K 2
Types of Loop
Loops are the elements of programming in which a part of code is repeated a particular number of times. Loop executes the series of statements many times till the conditional statement becomes false.
Loops
Any task which is repeated more than one time is called a loop. Basically, loops can be divided into three types as while, do-while and for loop. There are so many programming languages like C, C++, JAVA, PYTHON, and many more where looping statements can be used for repetitive execution.
While Loop
Loop is a feature in the programming language. It helps us to execute a set of instructions regularly. The block of code executes until some conditions provided within that Loop are true.
#1 Name Use a loop to write your name ten times
#7 Namecount Redo #1 but every time you print your name out also print out the value of the loop counter(for example the first three lines might look like this) do this ten times
Patti K 0
Patti K 1
Patti K 2
1) Since programming language is not specified I have written programs in python programming langauage
2) Below we have two programs
- Program to use a loop to write your name ten times
- It initialize the name variable with "Patti K"
- Run a for loop 10 times
- print name
- Program to use a loop to write your name ten times and also print out the value of the loop counter
- It initialize the name variable with "Patti K"
- Run a for loop 10 times
- print name and counter value
3) Save programs in python file and run
Step by step
Solved in 5 steps with 2 images