Documentos de Académico
Documentos de Profesional
Documentos de Cultura
ANTENOR ORREGO
FACULTAD DE INGENIERIA
ESCUELA PROFESIONAL DE SISTEMAS Y PROGRAMACIÓN
CURSO:
ALGORITMIA Y PROGRAMACIÓN
PROFESOR:
ALUMNO:
TURNO:
TRUJILLO – PERÚ
2022
Trabajo N°5
Algoritmos Repetitivos 2
Análisis: EFD
N,N1, N2 PROCESO mcd
Implementacion en Java
Diseño de algoritmo
import java.io.*;
public class Main
{public static void main(String[] args)throws IOException
{BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int c,N,n1,n2,d,mcd;
{ do{System.out.print("\nPrimer numero:");
n1=Integer.parseInt(br.readLine());
}
while(n1<=0);
do{System.out.print("Segundo numero:");
n2=Integer.parseInt(br.readLine());
}
while(n2<=0);
mcd=1;
d=2;
while(d<=n1 || d<=n2)
edp, epm
Implementacion en Java
import java.io.*;
public class Main {
public static void main(String[] args)throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String Sex;
do {
System.out.println("Ingresa la cantidad de alumnos");
N = Integer.parseInt(br.readLine());
}while (N<=0);
do {
do {
System.out.println("Elije el sexo del "+c+"° alumno");
System.out.println("Ingresa 'M' para el sexo MASCULINO");
System.out.println("Ingresa 'F' para el sexo FEMENINO");
Sex = br.readLine().toUpperCase();
if (Sex.equals("M")) cho++;
else cmu++;
do {
System.out.println("Ingresa la nota del "+c+"° alumno");
Not = Integer.parseInt(br.readLine());
do {
System.out.println("Ingresa la edad del "+c+"° alumno");
ed = Integer.parseInt(br.readLine());
}while (ed<=0);
Resultados
if (Sex.equals("M")) {
seph = seph+ed;
eph = seph/N;
}
else {
sepm = sepm + ed;
epm = sepm/N;
}
c++;
}while (c<=N);
Implementacion en Java
import java.io.*;
public class Main
Diseño de algoritmo
{public static void main(String[]args)throws IOException
itmo
{BufferedReader br=new BufferedReader(new
InputStreamReader(System.in));
int n1,n2,n,c,pro=0;
if(n2<0)
{n=-n2;}
else
{n=n2;}
for(c=0;c<n;c=c+1)
{pro=pro+n1;}
if(n2<0)
{pro=pro*(-1);}
Análisis: EFD
N PROCESO fac
Implementacion en Java
Diseño de algoritmo
import java.io.*;
public class Main
{public static void main(String[]args)throws IOException
{BufferedReader br=new BufferedReader(new
InputStreamReader(System.in));
int fac=1,n1,c1,c2,cdv,d=2;
do{System.out.print("\nIngresar el numero:");
n1=Integer.parseInt(br.readLine());}
while(n1<=0);
cdv=0;
for(c2=1;c2<=n1;c2++)
{ if(n1 % c2==0)
{cdv=cdv+1;}}
if(cdv==2)
{for(c1=1;c1<=n1;c1++)
{fac=fac*c1;}