KEMBAR78
Loop Assignment | PDF
0% found this document useful (0 votes)
18 views1 page

Loop Assignment

Uploaded by

May Thet Tun
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)
18 views1 page

Loop Assignment

Uploaded by

May Thet Tun
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
You are on page 1/ 1

Loop Assignment

1. Write a program that checks if a number entered by the user is a


prime number.
2. Write a program that checks whether a number entered by the user
is a palindrome.
3. Write a program that checks if a number entered by the user is an
Armstrong number (a number that is equal to the sum of its own
digits each raised to the power of the number of digits).
4. Write a program that finds the greatest common divisor (GCD) of
two numbers entered by the user.
5. Write a program that prints all prime numbers in a given range [low,
high] entered by the user.
6. Write a program that calculates base^exponent using a loop, where
base and exponent are entered by the user.

7. Write a program that checks if a year entered by the user is a leap


year.
8. Write a program that calculates the sum of the series: 1 + 1/2 + 1/3
+ ... + 1/n for a given n.
9. Write a program that checks if a number entered by the user is a
perfect number (a number that is equal to the sum of its proper
divisors).
10. Write a program that calculates the least common multiple (LCM)
of two numbers entered by the user.

You might also like