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

Assignment 5

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Assignment 5

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment-5

Looping Statements using while, for, do-while loop Date:05/11/2024

1. WAP to print first n natural numbers using while loop.


2. WAP to print the multiplication table of any entered number.
3. Print the series:
a) 1, 3, 5, 7, …., N
b) 1, 2, 4, 8,….., N
4. WAP to find the factorial of a number.
5. WAP to find the Fibonacci sequence upto N.
6. Find sum of digits of an entered number using while loop.
7. Find the GCD of two entered numbers.
8. Find sum of all even numbers in a given range.
9. Check whether an entered number is a prime or composite number.
10. WAP to reverse a number.
11. Check whether an entered number is a palindrome number or not.
12. Check whether an entered number is an Armstrong number or not.
13. WAP to count the number of digits of a given number.
14. Find Fibonacci series up to an entered number using do-while loop.
Test data: Entered number=90
Output series: 0 1 1 2 3 5 8 13 21 34 55 89
15. Find the sum of all user entered numbers until the sum exceeds 100 using do while loop.
16. Find the factorial of any user entered number using for loop.
17. Print all natural numbers in descending order up to 1 from an entered number except
the numbers divisible by 7 (use continue statement)
18. Display the binary equivalent of an entered decimal number.
19. Display the decimal equivalent of an entered binary number.
20. Print the following pattern:
12345
1234
123
12
1
21. Print the following pattern:
A
AB
ABC
ABCD
ABCDE
ABCDEF
22. Print the following pattern:
1
123
12345
123456
1234567
23. Print the following pattern:
1
00
111
0000
11111
24. Print the following pattern:

25. Print the following pattern:

26. Print all prime numbers in a given range.


27. Print all palindrome numbers in a given range.
28. Print all Armstrong numbers in a given range.
29. Print all numbers in a range that are divisible by 5 and 7

You might also like