progrmacion-con-for-y-while.docx

Upload: oscar-jean-paul-sullca-romero

Post on 06-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

UN INGENIERO QUIMICO UNA EMPRESA

Ejercicios de programacin con FOR y WHILE

CURSO:LENGUAJE DE PROGRAMACION CATEDRTICO:Ing. HENRRY R. OCHOA LEON

ALUMNO :GAMARRA ALCANTARA, MARLIN DOUGLAS SEMESTRE :II AHUANCAYO PERU

EJERCICIOS DE PROGRAMACIN CON FOR Y CON WHILE1)PROGRAMACION CON FORfunction for1clc,clearn=input('ingrese el numero:');for i = 1:100 m = n*i; fprintf(1,'%g x %g = %g\n',n,i,m);endDIAGRAMA DE FLUJO

INICIOIngresar NumPara Cont=1,100Escribir Num, x, cont, =Num*ContFIN

2)PROGRAMACION CON FORfunction for2clc,clearn=input('ingrese el numero:');for i = 2:2:100 m = n*i; fprintf(1,'%f x %f = %f\n',n,i,m);endDIAGRAMA DE FLUJO

INICIOIngresar NumPara Cont=2:2:100Escribir Num, x, cont, =Num*ContFIN

3)PROGRAMACIN CON FORfunction for3clc,clearn=input('ingrese el numero:');for i = 1:100 m = n*sqrt(i); fprintf(1,'%f x sqrt(%f) = %f\n',n,i,m);endDIAGRAMA DE FLUJO

INICIOIngresar NumPara Cont=1:100Escribir Num, x, cont, =Num*sqrt(Cont)FIN

4)PROGRAMACIONfunction while1clc,clearn=input('ingrese el numero de terminos:');sum=0;c=1;par=0;while c