-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathback_Substitution.c
More file actions
44 lines (38 loc) · 841 Bytes
/
Copy pathback_Substitution.c
File metadata and controls
44 lines (38 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include "identity_Making.c"
void back_Substitution(int m,int n,float A[m][n+1],int solution_Type)
{
int min = 0;
if(n>m){
min=m;
}else{
min = n;
}
int i,j,k,l, count=0;
printf("\n-------------------------------------------------------------------------------------\n");
printf("\n-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- Back Substitution -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-\n");
for(i = 0; i < min; i++){
if(A[i][i] != 0){
count++;
}
}
for(i=min-1; i>=0; i--)
{
float pivot=A[i][i];
if(pivot)
{
for(j=i-1;j>=0;j--)
{
float coeff = A[j][i]/pivot;
for(k=n;k>=0;k--)
{
A[j][k] -= coeff*A[i][k];
}
}
print_Matrix(m,n,A);
}
}
identity_Making(m,n,A,solution_Type);
}