Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

My C++ code has no errors but will not display output when I build solution. Can someone help? Code: int main() { int n=0; while

My C++ code has no errors but will not display output when I build solution. Can someone help?

Code:

int main()

{ int n=0; while (n>=0); { int n, a = 1, b = 1, c, sum = 0; cout << "Please enter in sequence number (or -99 to quit): /n"; cin >> n; if (n >= 0) { c = 0;

for (n = 1; n < 20; n++); { c = a + 2 * b; cout << c << " "; sum += c; a = b; b = c;

} cout << "sum: " << sum << endl;

}

else if (n == -99) return 0; else if (n < 0 && n != -99) cout << "Enter a number >= 0 or -99."; } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning PostgreSQL

Authors: Salahaldin Juba, Achim Vannahme, Andrey Volkov

1st Edition

178398919X, 9781783989195

More Books

Students also viewed these Databases questions

Question

Why do we forget information?

Answered: 1 week ago

Question

Explain why Sheila, not Pete, should make the selection decision.

Answered: 1 week ago