Lab_3
Lab_3
1. Write a program to find the product of the first ten natural numbers.
a. Use while
b. Use do-while
c. Use for loops
2. Write a program to find the sum of all even numbers and sum of all odd
numbers separately in a given range input by the user.
3. Check if a given number is prime or not.
4. Write a program to print all prime numbers between 1 to 300. (Hint: Use
nested loops, break, and continue)
5. Find the sum of all the digits of a user input integer number using any
loop. Take the size of the number as input from user too.
6. Reverse a given four digited number and check if the number is
palindrome. (Eg. 1221, 3993 etc)
7. Calculate the power of a number. Do not use math.h.
8. Generate the multiplication table of any number. Print it out properly
9x1=9
9 x 2 = 18
…
9 x 10 = 90
9. Write a program to print out all Armstrong numbers between 1 and 500.
If sum of cubes of each digit of the number is equal to the number itself,
then the number is called an Armstrong number.