practica 5

3

Click here to load reader

Upload: geovanny-yungan

Post on 07-Jul-2015

39 views

Category:

Education


1 download

DESCRIPTION

K

TRANSCRIPT

Page 1: Practica 5

UNIVERSIDAD NACIONAL DE CHIMBORAZO

FACULTAD DE CIENCIAS DE LA EDUCACION HUMANAS Y

TECNOLOGIAS

NOMBRE: GEOVANNY YUNGAN

PRACTICA 5

EJERCICIO 1

Generar la siguiente serie:

2, 4, 8, 16, 32, 64, 128, 256, .

import java.util.Scanner;

class practica5 {

public static void main(String[] args) {

Scanner datos = new Scanner(System.in);

int n,a,r,i;

System.out.println ("***Serie del 2*** ");

System.out.print ("Ingrese la Cantidad de numeros a calcular: ");

n = datos.nextInt ();

r=0;

for(i=1;i<=n;i++){

r=r+1;

a=(int) Math.pow(2,r);

System.out.print ( + a+ "," );

}

}

}

Page 2: Practica 5

EJECUCION

EJERCICIO 2

Generar la siguiente serie:

3, 9, 27, 81, 243, 729, 2187,.

import java.util.Scanner;

class SERIE3 {

public static void main(String[] args) {

Scanner datos = new Scanner(System.in);

int n,a,r,i;

System.out.println ("*****Serie del 3:**** ");

System.out.print ("Ingrese la Cantidad de numeros a calcular: ");

n = datos.nextInt ();

r=0;

for(i=1;i<=n;i++){

r=r+1;

a=(int) Math.pow(3,r);

System.out.print ( + a+ "," );

}

}

}

Page 3: Practica 5

EJECUCION