Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

LAB -2(Loop)

1. WAP to display first 20 natural numbers.


2. WAP to find sum of all natural number from 1 to n.
3. WAP to find the sum of even numbers from 1 to 50.
4. WAP to print multiplication table of a given number.
5. WAP to count all the integers greater than 100 and less than 200 that are divisible by 7. Also find the
sum of these numbers.
6. WAP to count the number of digits in a number.
7. WAP to find the sum of digits of any digits number.
8. WAP to find the reverse of a number.
9. WAP to count and display all the factor of a number.
10. WAP to check whether a number is palindrome or not.
11. WAP to find the factorial of a number.
12. WAP to find the HCF/GCD of two numbers.
13. WAP to find the LCM of two numbers.
14. WAP to check whether the number is perfect or not. (Hint: positive integer which is equal to the sum
of its proper positive divisors. 6 is the first perfect number, Proper divisors of 6 are 1, 2, 3 and Sum
of its proper divisors = 1 + 2 + 3 = 6.)
15. WAP to find whether the number is prime number or not.
16. WAP to print all the prime number between 1 to n.
17. WAP to print Fibonacci series upto n terms.
18. WAP to display the following menu, and to perform task as per user’s choice repeatedly until his/her
choice is to exit.
1. Conversion of ASCII code to char
2. To find the sum of n natural numbers
3. Exit from program

Assigned By: Tara Bdr. Thapa Programming in C Pokhara University


Assigned By: Tara Bdr. Thapa Programming in C Pokhara University

You might also like