Está en la página 1de 9

Ejercicio 1

!CASO A-DO
!PROGRAM UNO
!INTEGER::X,Y,I
!X=-5
!DO I=1,11
!Y=X**3
!PRINT*,X,Y
!X=X+1
!END DO
!END PROGRAM

!CASO B - DO WHILE
!PROGRAM UNO
!INTEGER::X,Y
!X=-5
!DO WHILE(X<=5)
!Y=X**3
!PRINT*,X,Y
!X=X+1
!END DO
!END PROGRAM UNO

!CASO C - DO EXIT END DO


!PROGRAM UNO
!INTEGER::X,Y
!X=-5
!DO
!Y=X**3
!PRINT*,X,Y
!X=X+1
!IF (X>5) EXIT
!END DO
!END PROGRAM UNO

!*********************************************
!2 4 6 8 10 12 14 16 18 20
! 2.TABLA_DE_CUADRADOS
!PROGRAM CASO_A !DO
!INTEGER::X,Y,I
!X=2
!DO I=1,10
!Y=X**2
!PRINT*,X,Y
!X=X+2
!END DO
!END PROGRAM CASO_A

!PROGRAM CASO_B !DO WHILE


!INTEGER::A,B
!A=2
!DO WHILE(A<=20)
!B=A**2
!PRINT*,A,B
!A=A+2
!END DO
!END PROGRAM CASO_B

!PROGRAM CASO_C !DO..EXIT..END DO


!INTEGER::A,B
!A=2
!DO
!B=A**2
!PRINT*,A,B
!A=A+2
!IF (A>20) EXIT
!END DO
!END PROGRAM CASO_C
!*******************************************
!3.FUNCION TABULADA
!PROGRAM CASO_A !DO WHILE
!REAL::A,B
!A=3.0
!DO WHILE(A<=10.0)
!B=(A**2+A+3)/(A-2)
!PRINT*,A,B
!A=A+0.5
!END DO
!END PROGRAM CASO_A

!PROGRAM CASO_B !DO...EXIT..END DO


!REAL::A,B
!A=3.0
!DO
!B=(A**2+A+3)/(A-2)
!PRINT*,A,B
!A=A+0.5
!IF (A>10) EXIT
!END DO
!END PROGRAM CASO_B
!********************************************
!4.MODIFICACION PROBLEMA 3
!PROGRAM CASO_A !DO WHILE
!REAL::A,B
!A=3.0
!DO WHILE(A<=10)
!IF(A==5)THEN
!A=A+0.5
!END IF
!B=(A**2+A+3)/(A-5)
!PRINT*,A,B
!A=A+0.5
!END DO
!END PROGRAM CASO_A

!PROGRAM CASO_B !DO...EXIT..END DO


!REAL::A,B
!A=3.0
!DO
!IF(A==5)THEN
!A=A+0.5
!END IF
!B=(A**2+A+3)/(A-5)
!PRINT*,A,B
!A=A+0.5
!IF (A>10) EXIT
!END DO
!END PROGRAM CASO_B
!************************************
!5.REPETICION ANIDADA F: S=A**2+SINB
!PROGRAM CASO_A !DO
!INTEGER::I,J,A
!REAL::B
!DO I=1,6
!A=I

!B=0.0
! DO J=0,5
! IF(J==0)THEN
! END IF !CORREGIR LUEGO

! S=A**2+SIN(B)
! PRINT*,A,B,S
! B=B+0.125
! END DO
!END DO
!END PROGRAM CASO_A

!PROGRAM CASO_B
!INTEGER::I,J,A
!REAL::B
!DO WHILE(I<=6)
!A=I
!B=0.0
! DO WHILE (J<=0.5)
! S=A**2+SIN(B)
! PRINT*,A,B,S
! B=B+0.125
! END DO
!END DO
!END PROGRAM CASO_B

!PROGRAM CASO_C
!INTEGER::A
!REAL::B,S
!A=1
!DO
!B=0
! DO
! S=A**2+SIN(B)
! PRINT*,A,B,S
! B=B+0.125
! IF(B>0.5) EXIT
! END DO
! A=A+1
! IF(A>6)EXIT
!END DO
!END PROGRAM CASO_C
!***************************************
!6.SUMA DE CUBOS
!PROGRAM SUMA_CUBOS !CASO DO
! DO VC = Vi,Vf, INC
!....
!....
!END DO
!INTEGER::X,S,I
!X=6
!S=0
! DO I=1,5
! S=S+X**3
!X=X+2
!END DO
!PRINT*,"LA SUMA = ",S
!END PROGRAM SUMA_CUBOS

!PROGRAM SUMA_CUBOS !CASO DO WHILE


!INTEGER::X,S
!X=2
!S=0
!DO WHILE(X<=14)
! S=S+X**3
! X=X+2
!END DO
!PRINT*,"LA SUMA = ",S
!END PROGRAM SUMA_CUBOS

!PROGRAM SUMA_CUBOS !CASO DO..EXIT..END DO

!FALTA DONT`FORGET =D

!***********************************************
!7.PROBLEMA DEL PROMEDIO
!PROGRAM PROMEDIO !CASO DO
!REAL::X,S
!X=8
!S=0
! DO I=1,11
! S=S+X
!X=X+1
! DO J=1,11
! P=S/11
! END DO
!END DO
!PRINT*," PROMEDIO = ",P
!END PROGRAM PROMEDIO

!PROGRAM PROMEDIO !CASO DO, OTRO EJEMPLO


!INTEGER::S,X,I,J
!J=0
!S=0 !FALTA
!X=8
!DO I=1,11
!S=S+X
!X=X+1
!J=J+1
!END DO
!PROM = S/J
!PRINT*,"PROMEDIO",PROM
!END PROGRAM PROMEDIO

!********************************************
!8-ESCRIBA UN PROGRAM EN FORTRAN PARA TABULAR LA FUNCION
!Y= (X**3+7*X-5)/(X**3-3*X**2-4*X+12)

!PROGRAM CASO_A !CASO DO WHILE


!INTEGER::X
!REAL::Y,Z
!X=-4
!Y=0
!DO WHILE (X<=9)
!Z= X**3-3*X**2-4*X+12
! IF(Z==0)THEN
! X=X+1
! Z=X**3-3*X**2-4*X+12
! CYCLE
! END IF
!Y= (X**3+7*X-5)/Z
!PRINT*,X,Y
!X=X+1
!Y= (X**3+7*X-5)/Z
!END DO
!PRINT*,"LA TABULACION ES = "
!END PROGRAM CASO_A

!PROGRAM CASO_A !CASO DO WHILE


!INTEGER::X
!REAL::Y,Z
!X=-4 !OTRO CASO
!Y=0
!DO WHILE (X<=9)
!Z= X**3-3*X**2-4*X+12
! IF(Z==0)THEN
!PRINT*,X
! X=X+1
! ELSE
! X=X+1
! END IF
! END DO !CORREGIR, NO SALE
! Z=X**3-3*X**2-4*X+12
!Y=(X**3+7*X-5)/Z
!PRINT*,X,Y
!X=X+1
!Y= (X**3+7*X-5)/Z
!END DO
!PRINT*,"LA TABULACION ES = "
!END PROGRAM CASO_A

!**************************************

!9.PROGRESION GEOMETRICA

!PROGRAM PROGRESION_GEOMETRICA !CASO DO WHILE


!INTEGER::S,N
!INTEGER,PARAMETER::R=8
!INTEGER,PARAMETER::A=3
!N=1
!S=1
!DO WHILE(N<=8)
!S= A*R**(N-1)
!PRINT*,"PARA EL VALOR DE N",N
!N=N+1
!PRINT*,"EL RESULTADO ES",S
!S= A*R**(N-1)
!END DO

!END PROGRAM PROGRESION_GEOMETRICA

!PROGRAM NUEVE !OTRO CASO DO EXIT EN DO


!REAL::A,R,S !FALTO CASO PROPIO
!INTEGER::N
!A=3;R=4;N=1
!USANDO DO EXIT
!DO
!S=A*R**(N-1)
! PRINT*,S
!N=N+1
!IF(N>8) EXIT
!END DO
!***************************************
!10.TABULACION DE FUNCIONES TRIGONOMETRICAS
!PROGRAM TABULACION_TRIGONOMETRICA
!REAL::X,T
!X=0.0
!Y=0.0
!DO WHILE(X<=1.0)
!T=SIN(X)*SIN(X)+COS(X)*COS(X)
! IF(X>A.AND.X<=B)THEN (CORREGIR)
! X=X+0.1
! T=SIN(X)*SIN(X)+COS(X)*COS(X)
! END IF
!T=SIN(X)*SIN(X)+COS(X)*COS(X) !TEORICAMENTE MAL
!PRINT*,X,T SALE FUNCION SIGNO
!X=X+0.1
!T=SIN(X)*SIN(X)+COS(X)*COS(X)

!END DO
!END PROGRAM TABULACION_TRIGONOMETRICA

!CASO DO, DO WHILE, DO...EXIT...END DO

!PROGRAM DIEZ !OTRO CASO


!REAL::X,Y
!X=0.0
!DO I=1,11
!Y=SIN(X)*SIN(X)+COS(X)*COS(X)
!PRINT*,X,Y
!END DO
!END PROGRAM DIEZ

!**************************************
!PROBLEMA 11

!PROGRAM ONCE
!REAL::X,Y !CASO DEL PROFESOR,DO
!INTEGER::SIGNO
!X=1
!SIGNO=1!+1
!DO WHILE (X<=15)
!Y=(X**(-3))*SIGNO
!PRINT*,X,Y
!X=X+2
!SIGNO=-SIGNO
!END DO
!END PROGRAM ONCE

!************************************
!PROBLEMA 12

PROGRAM DOCE
REAL::S,X
INTEGER::SIGNO.I
X=1,0
S=0.0
SIGNO=+1 !+1
DO I=1,4
S=S+(1.0/X**3)*SIGNO
SIGNO=-SIGNO
X=X+2
END DO
END PROGRAM DOCE