Answered step by step
Verified Expert Solution
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started