0% found this document useful (0 votes)
7 views2 pages

Loop Practice Problems

Uploaded by

baeroos28
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Loop Practice Problems

Uploaded by

baeroos28
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

▪ Write a program to guess a number between 1 and 9.

▪ Write a program to identify either prime or not prime number based


on the user input

▪ Write a program to get the Fibonacci series between 0 and 50.

Note : The Fibonacci Sequence is the series of numbers : 0, 1, 1, 2, 3, 5,


8, 13, 21, .... Every next number is found by adding up the two numbers
before it.

Expected Output : 1 1 2 3 5 8 13 21 34

▪ Write a program to construct the following pattern, using a nested for


loop.
*
* *
* * *
* * * *
* * * * *
* * * *
* * *
* *
*

▪ Write a program to construct the following pattern, using a nested for


loop.

10101
01010
10101
01010
10101
▪ Write a program to count how many times a letter appears in a word.

▪ Write a program to construct the following pattern, using a nested for


loop to print a number triangle

1
12
123
1234
12345

You might also like