Lab 09, Esc101, 2004-05 Semester-II
Solve the following problems
Problem 1
Write a program to print the all possible sum of a given number.eq if
the given number is 5 it should print
5
4 1
3 2
3 1 1
2 2 1
2 1 1 1
1 1 1 1 1
Problem 2
Calculate the Determinant of a matrix using recursion.Determinant of a
matrix A(n.n) is given by
det(A)= | a11 a12 ... a1n | = a11*det(A1,1) -
a12*det(A1,2)...a1n(-1)^(1+n)*det(A1,n)
|
a21 a22 ... a2n |
....................
|
an1........ ann |
where det(Ai,j) is determinant of the matrix after removing ith row and
jth column.
Problem
3
Write a recursive method to check if a given string is a
palindrome or not.A palindrome is a string that is identical to its
reverse,ignoring uppercase and lowercase and punctuation marks.Examples
are "Radar","Madam,I m Adam" etc.