Programming for Problem Solving (ES-CS291)
2024
ROLL
NAME
Learning outcome: Students will be able to solve iterative
problems.
ASSIGNMENT: II
Sl. Program Listing Date Signature
No
1 Write a C program to find the factorial of a given number.
2 Write a C program to check whether a given number is prime
number or not.
3 Write a C program to check whether a given number is
palindrome or not.
4 Write a C program to check whether a given number is
Armstrong number or not. (e.g. 153 = 13 +53 + 33)
5 Write a C program to check whether a given number is
Krishnamurthy number or not (e.g. 145 = 1! +4! + 5! ).
6 Evaluate summation of the following series
a. 1 + 2 + 3 + 4 +…..n terms
b. 1 + 4 + 9 + 16 +….n terms
c. 1 + ½ + 1/3 +….n terms
d. 1! + 2! + 3! +……n terms
e. 11 + 22 + 33 + 44 + ... n terms
f. 1 + (1+2) + (1+2+3) +……n terms
g. x - x3/3! + x5/5! -…… n terms
7. 1. Generate following triangle for n lines:
a) b) c) d)
1 1 4321 1
121 01 321 23
12321 101 21 456
1234321 0101 1 7891
e) f) g)
1 ABCDEDCBA 1
1 2 ABCD DCBA 1 1
2 3 4 ABC CBA 1 2 1
3 4 5 6 AB BA 1 3 3 1
4 5 6 7 8 A A 1 4 6 4 1
SIGNATURE OF STUDENT........................................................
SIGNATURE OF FACULTY........................................................