PROGRAM VECTS * * Calculates the vector a*x + y, where a is a real constant and * x and y are given vectors. * INTEGER N PARAMETER(N=6) REAL A(100), B(100), C OPEN(UNIT=1,FILE='inp.dat',STATUS='UNKNOWN') DO 10 I = 1,N A(I) = 0. B(I) = 0. 10 CONTINUE DO 20 I = 1,N READ(1,*) A(I), B(I) 20 CONTINUE CLOSE(1) CALL SAXPY(N,2.0,A,B) WRITE(*,*) 'To diavusma eivai:' DO 30 I = 1,N WRITE(*,100) B(I) 30 CONTINUE 100 FORMAT(1X,F10.5) STOP END SUBROUTINE SAXPY(N,A,X,Y) INTEGER N, I REAL A, X(*), Y(*) DO 10 I = 1,N Y(I) = A * X(I) + Y(I) 10 CONTINUE RETURN END