#include <iostream> int main() { float val, sum, incr; int ok,num; ok = 0; while
ID: 3615097 • Letter: #
Question
#include <iostream> int main() {
float val, sum, incr; int ok,num; ok = 0;
while (!ok) { cout << "Enter an even number:";
cin >> num; if (num % 2 == 2) cout << "The number" << num << " is not a positive even number." <<endl; else cout << num << " is even!" << endl<< endl; } incr = 1 / num;
for (val = 20.0F; val < 21.0; val += incr) { cout <<val; sum += val; } cout << "The sum is " << sum<< endl; return 0; }
It should looklike this
#include <iostream> int main() {
float val, sum, incr; int ok,num; ok = 0;
while (!ok) { cout << "Enter an even number:";
cin >> num; if (num % 2 == 2) cout << "The number" << num << " is not a positive even number." <<endl; else cout << num << " is even!" << endl<< endl; } incr = 1 / num;
for (val = 20.0F; val < 21.0; val += incr) { cout <<val; sum += val; } cout << "The sum is " << sum<< endl; return 0; }
It should looklike this
Explanation / Answer
please rate - thanks somewhat neater #include using namespace std; int main() { float val, sum, incr; int ok,num; ok = 0; while (ok==0) { cout > num; if (num % 2 == 1||numRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.