Q1. Write a program that tests formula for the sum of a
geometric series a(rn-1)/(r-1). Given a, r and n find sum of the
series using your method and the formula (again through the program) and show
that the results are same.
Q2. Write a program to print Pascal’s triangle consisting of n rows. Each row of the triangle consists of binomial coefficients. Assuming that the first element corresponds to zeroth row and zeroth column, the entry corresponding to nth row and rth column is nCr .
The triangle looks like:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
Reference: http://mathworld.wolfram.com/PascalsTriangle.html
Q3 Write a program that tests whether a given positive number is palindrome. A palindrome is a number which reads same from both the ends; for example: 1221 and 191
Q4. Write a program that converts an integer (base 10) into equivalent octal number and vice versa.