Question
LABELS PROGRAM LISTING PROGRAM gelmn c Gauss elimination method to solve a linear system of eqns dimension a(30,30),x(30) write(*,10) 10 format(1x,'To solve a linear system
LABELS | PROGRAM LISTING | |
| PROGRAM gelmn | |
| c | Gauss elimination method to solve a linear system of eqns |
|
| dimension a(30,30),x(30) |
|
| write(*,10) |
| 10 | format(1x,'To solve a linear system of equations using Gauss ',\) |
|
| write(*,20) |
|
| format(1x,'To solve a linear system of equations using Gauss ',\) |
| 20 | format(1x,'Elimination method with pivoting(using subroutine).') |
|
| write(*,*)'Enter the number of variables:' |
|
| read(*,*)n |
|
| write(*,*)'Enter the coefficients in the equations:' |
|
| read(*,*)((a(i,j),j=1,n+1),i=1,n) |
|
| DO 30 k=1,n-1 |
|
| call pivot(a,k,n) |
|
| DO 90 i=k+1,n |
|
| u=a(i,k)/a(k,k) |
|
| DO 100 j=k,n+1 |
|
| a(i,j)=a(i,j)-u*a(k,j) |
| 100 | continue |
| 90 | continue |
| 30 | continue |
|
| IF(abs(a(n,n)).LE.(.00001))THEN |
|
| write(*,*)'Ill conditioned equations.' |
|
| STOP |
|
| ENDIF |
|
| x(n)=a(n,n+1)/a(n,n) |
|
| DO 60 i=n-1,1,-1 |
|
| sum=0 |
|
| DO 70 j=i+1,n |
|
| sum=sum+a(i,j)*x(j) |
| 70 | continue |
|
| x(i)=(a(i,n+1)-sum)/a(i,i) |
| 60 | continue |
|
| write(*,*)'Values of the variables are as follows:' |
|
| DO 80 i=1,n |
|
| write(*,110)x(i) |
| 110 | format(1x,F10.3) |
| 80 | continue |
|
| STOP |
|
| END |
|
| subroutine pivot(a,k,n) |
|
| dimension a(30,30) |
|
| real mx |
|
| integer p,q |
|
| mx=abs(a(k,k)) |
|
| p=k |
|
| DO 40 m=k+1,n |
|
| IF(abs(a(m,k)).GT.mx)THEN |
|
| mx=abs(a(m,k)) |
|
| p=m |
|
| ENDIF |
| 40 | continue |
|
| IF(mx.LE.(.00001))THEN |
|
| write(*,*)'Ill-conditioned equations.' |
|
| STOP |
|
| ENDIF |
|
| DO 50 q=k,n+1 |
|
| temp=a(k,q) |
|
| a(k,q)=a(p,q) |
|
| a(p,q)=temp |
| 50 | continue |
|
| return |
|
| END |
Draw all flowgraphs (for every module) and calculate the cyclomatic complexity, v(G), essential complexity, ev(G), module design complexity, iv(G), system design complexity, S0, and integration complexity, S1 for the software code below.
(Please explain all subquestion answers in detail.)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started