C++ program for adding 10 numbers
#include <iostream>
int main() {
int sum = 0;
std::cout << "Enter 10 numbers:\n";
for (int i = 1; i <= 10; ++i) {
int number;
std::cout << "Number " << i << ": ";
std::cin >> number;
sum += number;
}
std::cout << "The sum is: " << sum << std::endl;
return 0;
}
Comments
Post a Comment