SHARE
TWEET

Untitled

a guest Sep 17th, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. gram for Gauss Elimination    #include<stdio.h>  int main()  {      inti,j,k,n;      float A[20][20],c,x[10],sum=0.0;      printf("\nEnter the order of matrix: ");      scanf("%d",&n);      printf("\nEnter the elem
  2. for(j=1; j<=(n+1); j++)          {              printf("A[%d][%d] : ", i,j);              scanf("%f",&A[i][j]);          }      }      for(j=1; j<=n; j++) /* loop for the generation of upper triangular matrix*/      {          for(i=1; i<=n; i++)          {              if(i>j)              {                  c=A[i][j]/A[j][j];                  for(k=1; k<=n+1; k++)                  {                      A[i][k]=A[i][k]-c*A[j][k];                  }              }          }      }      x[n]=A[n][n+1]/A[n][n];      /* this loop is for backward substitution*/      for(i=n-1; i>=1; i--)      {          sum=0;          for(j=i+1; j<=n; j++)          {              sum=sum+A[i][j]*x[j];          }          x[i]=(A[i][n+1]-sum)/A[i][i];      }      printf("\nThe solution is: \n");      for(i=1; i<=n; i++)      {          printf("\nx%d=%f\t",i,x[i]); /* x1, x2, x3 are the required solutions*/      }      return(0);  }    2.6 Output o Gauss Elimination
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top