Anderson Pozo

Generation

generate functionSat, 24 Jun 2023

Hacer un programa para ingresar una lista de números que finaliza cuando se ingresa un cero, luego informar el máximo y la posición dentro de la lista.

#include <iostream> using namespace std; int main() { int max = 0, pos = 0, n = 1, i = 1; while (n != 0) { cout << "Ingrese el numero: " << endl; cin >> n; if (n > max) { max = n; pos = i; } i++; } cout << "El numero max es " << max << " y esta en la posicion " << pos; return 0; }

Want to kickstart your project?Use the new AI Studio to create your code