300 quastion problem solving about for loop with expected aoutput
- User
300 quastion problem solving about for loop with expected aoutput
- Assistant
Sure! Here are 10 sample questions about for loops along with their expected outputs:
-
Write a for loop that prints the numbers from 1 to 10. Expected output: 1 2 3 4 5 6 7 8 9 10
-
Write a for loop that prints the even numbers from 2 to 10. Expected output: 2 4 6 8 10
-
Write a for loop that prints the square of numbers from 1 to 5. Expected output: 1 4 9 16 25
-
Write a for loop that prints the reverse of a given string "Hello". Expected output: o l l e H
-
Write a for loop that calculates the sum of numbers from 1 to 5. Expected output: 15
-
Write a for loop that prints the ASCII values of the characters 'A' to 'Z'. Expected output: 65 66 67 ... 90
-
Write a for loop that prints the Fibonacci sequence up to the 10th term. Expected output: 0 1 1 2 3 5 8 13 21 34
-
Write a for loop that adds all the even numbers from 1 to 20. Expected output: 110
-
Write a for loop that prints the multiplication table of 5 up to 10. Expected output: 5 10 15 ... 50
-
Write a for loop that prints the factors of a given number 12. Expected output: 1 2 3 4 6 12
-