Last active
August 29, 2015 14:22
-
-
Save slyphon/813b37dd360ee2e5e860 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
float sum = 0; | |
int i; | |
for (i = 0; i < 5; i++) | |
{ | |
int t = 0; | |
cout << "Please enter in number " << i + 1 << endl; | |
cin >> t; | |
sum = sum + t; | |
} | |
if ((sum + 0.5) >= (int (sum + 1))) | |
{ | |
sum = sum + 1; | |
sum = static_cast<int>(sum); | |
cout << "The sum rounds to " << sum << endl; | |
} | |
else | |
{ | |
sum = static_cast<int>(sum); | |
cout << "The sum rounds to " << sum << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment