You are on page 1of 6

KATHMANDU UNIVERSITY

DEPARTMENT OF CIVIL
ENGINEERING

Gauss- Siedel Method Using C++

Submitted by: Anish Pokharel Submitted to: Dr. Saraswati Acharya


Roll no: 41
Group: CIEG II/II
Algorithm:
Take the dimensions of the matrix p and its element as input.
Take initial values of x and no. of iterations q as input.
While q>0
Make a for loop i=0 to p-1.
Initialize n[i]=(b[i]/a[i][i]).
Make a for loop i=0 to p-1.
If(j==i)
n[i]=n[i]-(a[i][j]/a[i][i] *m[j].
m[i]=n[i].
Decrease q.
Here a[i][j]=input matrix.
b[i]=this array takes values of the right side of the equation.
m[i]=stores initial values of x.
Here no. of iterations= 3
Here no. of iterations=5

You might also like