/* Program that calculates the sum of all entered real numbers (until the user presses -999) and displays it. */ #include<iostream> using namespace std; int main() { float num, sum = 0; do { cout << "Enter a number?\t"; cin >> num; sum = sum + num; cout << "To Display Sum press \"-999\"?\t"; cin >> num; } while (num != -999); cout << "Sum of all The Entered numbers is \t" << sum << endl; return 0; }
No comments:
Post a Comment