C234567
      PROGRAM MYPLOT
C          
C Kuriws programma.
C Input: Ta akra tou diastnmatos 
C        kai to plnthos twv upodiastnmatwv.
      EXTERNAL F
      REAL A,B
      INTEGER N
      WRITE(*,*) 'Dwse ta akra tou diastnmatos a kai b (a<b):'
      READ(*,*) A,B
      WRITE(*,*) 'Dwse to plnthos twv upodiastnmatwv n:'
      READ(*,*) N
C   
C     Klnsn tns subroutine PLOTW
C
      CALL PLOTW(F,A,B,N)
      STOP
      END


      SUBROUTINE PLOTW(FX,AX,BX,NINT)
C
C Skopos: ypologizei tis times tns suvartnsns FX sta NINT + 1
C         snmeia evos omoiomorfou diamerismou tou diastnmatos
C         [AX,BX] kai apothnkeuei se duo stnles tis times x kai f(x)
C         sto arxeio GRAPH.DAT
C     
      EXTERNAL FX
      REAL AX,BX,H,X
      INTEGER NINT, I
      OPEN(1,FILE='GRAPH.DAT')
      H = ABS(BX-AX)/FLOAT(NINT)
      X = AX
      DO 10 I = 0, NINT
        WRITE(1,*) X,FX(X)
        X = X + H  
 10   CONTINUE
      CLOSE(1)
      RETURN
      END


      REAL FUNCTION F(X)
C  Edw divetai n suvartnsn f(x).
      REAL X
      F = SIN(X*X) + COS(X)*COS(X)
      RETURN
      END
