#include <iostream>
using namespace std;
int main()
{
double sum = 0;
for(int i=0;i<15;i++)
{
double number;
do
{
cout << "Enter a number: ";
cin >> number;
cout << endl;
sum += number;
i++;
if (i == 15)
{
break;
}
}while(number>=0);
}
cout << "sum = " << sum << endl;
return 0;
}
Comments
Leave a comment