0% found this document useful (0 votes)
9 views1 page

Loops Practice

The document outlines a series of programming assignments that require the use of for loops to solve various problems. Tasks include printing numbers divisible by both 3 and 7, calculating the sum of squares, counting vowels, finding the largest number in an array, printing prime numbers, reversing a string, checking for palindromes, generating a sequence, counting character occurrences, and calculating the product of digits. Each assignment aims to enhance programming skills through practical applications.

Uploaded by

nasreenliaqat00
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)
9 views1 page

Loops Practice

The document outlines a series of programming assignments that require the use of for loops to solve various problems. Tasks include printing numbers divisible by both 3 and 7, calculating the sum of squares, counting vowels, finding the largest number in an array, printing prime numbers, reversing a string, checking for palindromes, generating a sequence, counting character occurrences, and calculating the product of digits. Each assignment aims to enhance programming skills through practical applications.

Uploaded by

nasreenliaqat00
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

Assignment

1. Write a program to print all numbers between 1 and 100 that are
divisible by both 3 and 7.
2. Create a program to calculate the sum of squares of the first 10
natural numbers using a for loop.
3. Write a program to count the number of vowels in a given string
using a for loop.
4. Write a program to find the largest number in an array using a for
loop.
5. Create a program to print all prime numbers between 1 and 50
using a for loop.
6. Use a for loop to print the reverse of a given string.
7. Write a program to check if a number is a palindrome using a for
loop.
8. Use a for loop to generate and print the first 10 numbers in the
sequence: 2, 4, 8, 16, 32, ...
9. Use a for loop to count how many times a specific character
appears in a string.
10. Write a program to calculate the product of all digits of a
given number using a for loop.

You might also like