💻 Hacer un programa que muestre la serie y el producto de N números ingresados.
Algoritmo programacion_work
//Calcular el producto de N números
Definir N, pro, f como Entero;
pro <- 1;
Escribir Sin Saltar "VALOR DE N : ";
Leer N;
Para f <- 1 Hasta N con Paso 1 Hacer
Escribir Sin Saltar f, " ";
pro <- pro * f;
FinPara
Escribir "";
Escribir "PRODUCTO DE ",N," ES : ",pro ;
FinAlgoritmo
print("MUESTRA EL PRODUCTO DE N")
pro = 1
N = int(input("CANTIDAD DE NÚMEROS : "))
for f in range(1,N+1):
print(f, end=" ")
pro*=f
print()
print("PRODUCTO DE",N,"ES :",pro)
#include<stdio.h>
int main() {
int pro=1, N;
printf("CANTIDAD DE NUMEROS : ");
scanf("%i",&N);
for(int f=1; f<=N; f++){
printf("%d\n",f);
pro*=f;
}
printf("\nPRODUCTO DE %d : %d", N, pro);
return 0;
}
#include<iostream>
using namespace std;
int main() {
int pro=1, N;
cout << "CANTIDAD DE NÚMEROS : ";
cin >> N;
for (int f=1; f<=N; f++){
cout << f << " ";
pro*=f;
}
cout << endl;
cout << "PRODUCTO DE" << N << " : " << pro << endl;
return 0;
}
package programacion_work;
import java.util.Scanner;
public class producto_de_N {
public static void main(String[] args) {
Scanner ingreso=new Scanner(System.in);
int pro=1, N;
System.out.print("CANTIDAD DE NÚMEROS : ");
N = Integer.parseInt(ingreso.next());
for (int f=1; f<=N; f++){
System.out.print( f + " ");
pro*=f;
}
System.out.println("\nPRODUCTO DE " + N + " : " + pro);
}
}