The document outlines a series of programming tasks that involve using for loops to perform various operations. These tasks include printing prime numbers, calculating sums, generating sequences, creating patterns, and implementing algorithms. Each task is designed to enhance programming skills through practical exercises.
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 ratings0% found this document useful (0 votes)
6 views1 page
Assignment No.11 For Loop
The document outlines a series of programming tasks that involve using for loops to perform various operations. These tasks include printing prime numbers, calculating sums, generating sequences, creating patterns, and implementing algorithms. Each task is designed to enhance programming skills through practical exercises.
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
You are on page 1/ 1
1. Print prime numbers from 1 to 20 using a for loop.
2. Calculate the sum of numbers from 1 to 50 using a for loop.
3. Print the square of numbers from 1 to 15 using a for loop. 4. Create a countdown timer that starts from 10 and counts down to 0 using a for loop. 5. Generate the Fibonacci sequence up to the 10th term using a for loop. 6. Print a multiplication table for a given number up to 10 using a nested for loop. 7. Create a program that finds the factorial of a number using a for loop. 8. Write a program that prints a pattern of stars in the shape of a right-angled triangle using a for loop. 9. Create a program that checks whether a given number is prime or not using a for loop. 10.Build a program that calculates the sum of digits of a given number using a for loop. 11.Print the first n terms of the geometric progression 2, 6, 18, 54, ... using a for loop. 12.Implement a program that generates a multiplication table for numbers from start to end using nested for loops. 13.Write a program to print a pyramid pattern of stars using nested for loops. 14.Develop a program that simulates a basic dice roll, displaying the results for a user-specified number of rolls using a for loop. 15.Create a program that finds the common elements in two lists using nested for loops. 16.Implement a program to find all prime numbers in a given range using a for loop and the Sieve of Eratosthenes algorithm. 17.Build a program that generates the nth term of the arithmetic progression 2, 5, 8, 11, ... using a for loop.