
C++
Publicado por Margarita (3 intervenciones) el 10/08/2021 22:06:31
ALGUIEN ME PUEDE AYUDAR CON LOS PASOS DE ESTE EJERCICIO PLISS LO NECESITO.
include <iostream>
#include <cctype> // toupper
using namespace std;
int main()
{
int suma = 0, count = 0, n;
char opcion;
do {
do {
cout << "Numero: ";
cin >> n;
if (n > 0)
{
suma += n;
count++;
}
} while (n > 0);
cout << endl << "Media Aritmetica: " << suma / float(count) << endl;
suma = 0;
count = 0;
cout << endl << "Repetir (S/n): ";
cin >> opcion;
opcion = toupper(opcion);
} while (opcion == 'S');
return 0;
}
include <iostream>
#include <cctype> // toupper
using namespace std;
int main()
{
int suma = 0, count = 0, n;
char opcion;
do {
do {
cout << "Numero: ";
cin >> n;
if (n > 0)
{
suma += n;
count++;
}
} while (n > 0);
cout << endl << "Media Aritmetica: " << suma / float(count) << endl;
suma = 0;
count = 0;
cout << endl << "Repetir (S/n): ";
cin >> opcion;
opcion = toupper(opcion);
} while (opcion == 'S');
return 0;
}
Valora esta pregunta


0