clase 1-lp

Upload: elvis-david-olivera-merlo

Post on 03-Mar-2016

217 views

Category:

Documents


0 download

DESCRIPTION

lenguaje de programacion

TRANSCRIPT

CLASE 1

1)!Este es mi primer programa en fortranProgram Calculo_dos_numeros !identificador del program !Declaracin de variablesReal::x,y,total !variables asociadas a valores enterosPrint*,"Ingrese primer nmero" !Este mensaje sale en la pantallaRead*,XPrint*,"Ingrese segundo nmero" !Este mensaje sale en la pantallaRead*,ytotal=x+yPrint*,"el total=",x,y,totalEnd program Calculo_dos_nmeros-----------------------------------------------------------------------------------------------------------------------------------2) CUATRO OPERACIONES MATEMTICAS PARA 2 VARIABLES

Program Oper_aritmeticas!Declaracion de variablesReal::x,y,total Print*,"Ingrese primer nmero" Read*,XPrint*,"Ingrese segundo nmero" Read*,ytotal1=x+ytotal2=x-ytotal3=x*ytotal4=x/yPrint*,"el total=" ,total1,total2,total3,total4End program Oper_aritmeticas________________________________________________________________________________3) VOLUMEN DE LA ESFERAProgram vol_esfera !Declaracin de variablesReal::R,V !R=Radio , V =Volumen !Declaracin de constante de tipo realREAL ,PARAMETER::PI=3.1416!Programa principalPRINT*, "INGRESE RADIO DE LA ESFERA"READ* ,RV=4./3*PI*R**3 !El punto es para que considere decimalesPRINT*,"VOLUMEN DE LA ESFERA= ",VEND PROGRAM VOL_ESFERA

Al Ejecutar: INGRESE RADIO DE LA ESFERA 1 VOLUMEN DE LA ESFERA= 4.188800Press any key to continue