## Monday, May 11, 2009

### Sequence & Series Formulas

Arithmatic Progression

a,a+d,a+2d...., a+nd

- nth term of arithmatic progression

Tn = a + (n-1) d

- Sum of n - terms of arithmatic progression

Sn= (n/2) [ 2a + (n - 1) d]

- if a,b and c are in arithmatic progression then b = (a + c)/2.

a,ar,ar^2,..., ar^n

- nth term of geomatric progression is given by Tn = a r^(n-1).
- Sum of the first n terms of geomatric progression is given by;

Sn = a [ (1 - r^n) / (1 - r) ] , for r<1>

Sn = a [ (r^n - 1)/ (r - 1) ], for r>1

- if three quantities a,b and c are in GM then b = Sqrt(ac);
- Infinite Geomatric Series

when |r|<1

S* = a / (1 - r);

when |r|>1 then

S*= Infinity;

Harmonic Mean

- HM of a and b is 2ab/(a+b).
- nth terms of Harmonic Progression is Tn = 1 / [ a + (n-1) d ]

- Sum of first n - natural number is given by: summation (r=1 to n) : n (n + 1) / 2.
- Sum of squares of first n - natural number is given by summation (r=1 to n) :[ n ( n + 1 ) (2n + 1) ] / 6
- Sum of cubes of first n - natural number is given by summation (r=1 to n) : [n^2 (n+1)^2 ]

/4.

## Sunday, May 10, 2009

### Paging Program

Paging Related C Program:

Input : 45

Output : 10 + 10 + 10 + 10 + 5

#include

#include

void main()

{

int numberoflinksperpage=10;

int n,low,high,i=0;

clrscr();

printf("Enter number : ");

scanf("%d",&n);

while(n>numberoflinksperpage)

{

low=i;

high=i+1;

i++;

printf("\n display results from %d to %d ",numberoflinksperpage*low,numberoflinksperpage*high);

n=n-numberoflinksperpage;

}

low=i;

high=i+1;

printf("\n display results from %d to %d ",numberoflinksperpage*low,numberoflinksperpage*(high-1)+n);

getch();

}

Subscribe to:
Posts (Atom)