In C++ Please,
In the main(), below, write a program that prompts for (1) how many values to sum, and then (2) uses a summing loop to prompt for and add up 5 numbers.
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
< your answer goes here>
return 0;
}
#include <iostream> #include <iomanip> using namespace std; int main() { int count, total = 0, number; cout << "How many values to sum? "; cin >> count; for (int i = 0; i < count && i < 5; ++i) { cout << "Enter a number: "; cin >> number; total += number; } cout << "Sum: " << total << endl; return 0; }
Get Answers For Free
Most questions answered within 1 hours.