PROGRAM suma
REAL n, suma, diferencia
INTEGER i
suma=0
WRITE(*,*)'Ingrese un valor para n:'
READ(*,*)n
DO i=1,101
suma=suma+(1.+(i-1.)/10.)
END DO
diferencia=suma-n
WRITE(*,*)'La suma es:', suma
WRITE(*,*)'La diferencia con n es:', diferencia
END PROGRAM suma
Los errores:
Error: Symbol ‘suma’ at (1) cannot have a type
main.f95:6:5:
6 | suma=0 | 1 Error: ‘suma’ at (1) is not a variable
main.f95:11:5:
11 | suma=suma+(1.+(i-1.)/10.) | 1 Error: ‘suma’ at (1) is not a variable
main.f95:14:16:
14 | diferencia=suma-n | 1 Error: Symbol at (1) is not appropriate for an expression
main.f95:16:30:
16 | WRITE(*,*)'La suma es:', suma | 1 Error: Symbol at (1) is not appropriate for an expression
¿Me ayudarían? Gracias de antemano.