Dukelord123
Technical User
Ok, so I am new to FOTRAN and after installation, got it to work. I use MinGW. Now I try compiling a program and it compiles and runs. However the result is weird. See source code and result below. I get **** as answer. Can someone pls tell me what I am missing. Thanks and regards.
PROGRAM SUMNUM
INTEGER SUM,COUNTER,A
COUNTER=0
SUM=O
5 READ(*,*)A
SUM=SUM+A
COUNTER=COUNTER+1
IF (COUNTER .LT. 10) GOTO 5
WRITE(*,10)SUM
10 FORMAT(/,'THE SUM OF ALL TEN NUMBERS=',1X,I4)
STOP
END
The result below.
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
D:\Postgraduate\Programming\FORTRAN>gfortran first.f
D:\Postgraduate\Programming\FORTRAN>a.exe
1
2
3
4
5
6
7
8
9
0
THE SUM OF ALL TEN NUMBERS= ****
D:\Postgraduate\Programming\FORTRAN>
PROGRAM SUMNUM
INTEGER SUM,COUNTER,A
COUNTER=0
SUM=O
5 READ(*,*)A
SUM=SUM+A
COUNTER=COUNTER+1
IF (COUNTER .LT. 10) GOTO 5
WRITE(*,10)SUM
10 FORMAT(/,'THE SUM OF ALL TEN NUMBERS=',1X,I4)
STOP
END
The result below.
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
D:\Postgraduate\Programming\FORTRAN>gfortran first.f
D:\Postgraduate\Programming\FORTRAN>a.exe
1
2
3
4
5
6
7
8
9
0
THE SUM OF ALL TEN NUMBERS= ****
D:\Postgraduate\Programming\FORTRAN>