#include<stdio.h>int main()
{double matrix[10][10],a,b, temp[10];
int i, j, k, n;
printf("Enter the no of variables: ");scanf("%d", &n);printf("Enter the agumented matrix:\n");for(i = 0; i < n ; i++){
for(j = 0; j < (n+1); j++){
scanf("%lf", &matrix[i][j]);}}for(i = 0; i < n; i++){
for(j = 0; j < n; j++){
if(j>i){
a = matrix[j][i];b = matrix[i][i];for(k = 0; k < n+1; k++){
matrix[j][k] = matrix[j][k] - (a/b) * matrix[i][k];}}}}printf("The Upper triangular matrix is: \n");for( i = 0; i < n; i++){
for(j = 0; j < n+1; j++){
printf("%.2f", matrix[i][j]);printf("\t");}printf("\n");}printf("\nThe required result is: ");for(i = n-1; i>=0; i--){
b = matrix[i][n];for(j = n-1 ; j > i; j--){
b -= temp[n-j]*matrix[i][j];}temp[n-i] = b/matrix[i][i];printf("\n%c => %.2f",97+i, temp[n-i]);}}
Java Strut,hibernate tutorial,best java example with source code,android tutorial,android interview question,iPhone all example,all c languages example,c languages project with source code,iPhone and android project free download.
Wednesday, 13 February 2013
Numerical Methods: Solution of simultaneous algebraic equations using Gauss Elimination method in C
Labels:
Numerical Methods
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Comment