0% found this document useful (0 votes)
6 views

Lab_3

Lab notes of eee dept course code ee301 of nit Goa
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)
6 views

Lab_3

Lab notes of eee dept course code ee301 of nit Goa
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/ 2

Program Set 3 - Loops

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.

For eg, 153 = ( 1 * 1 * 1 ) + ( 5 * 5 * 5 ) + ( 3 * 3 * 3 )


10.Generate the following patterns
a. * * * * *
*****
*****
*****
*****
b. 1
11
111
1111

You might also like