Please rewrite the code fix the errors . Attach screenshot as well code and output Downvote for incorrect answer Thank you inhinclude Rsing namespace std; int maxResult( ) int maxVal for (int i { for...


Please rewrite the code fix the errors . Attach screenshot as well code and output


Downvote for incorrect answer



Thank you


inhinclude <bits/stdc++.h><br>Rsing namespace std;<br>int maxResult( )<br>int maxVal<br>for (int i<br>{<br>for (int j = 0; j <= n<br>0; i <= n; i += a)<br>i; j += b)<br>%3D<br>%3D<br>float z =<br>(float)(n<br>(i + j)) / (float)(c);<br>if (floor(z)<br>{<br>int x =<br>int y<br>ceil(z))<br>i / a;<br>j/ b;<br>maxVal = max(maxVal, x + y<br>(int)z);<br>return maxVal;<br>}<br>int main()<br>{<br>max cout << maxResult( );<br>return 0;<br>1 }<br>Input<br>Compilation failed due to fellowing<br>ons<br>main.cpp:7:23: error: 'n' was not declared in this scope<br>7| for (int i = 0; i <= n; i a)<br>main.cpp:7:31: error: 'a was not declared in this scope<br>for (int i = 0; i <= n; i t= a)<br>%3D<br>main.cpp:9:36: error: b' was not declared in this scope<br>| 6<br>for (int j = 0; j <= n - i; j - b)<br>%3D<br>main.cpp:11:45: error: 'c was not declared in this scope<br>

Extracted text: inhinclude Rsing namespace std; int maxResult( ) int maxVal for (int i { for (int j = 0; j <= n="" 0;="" i=""><= n;="" i="" +="a)" i;="" j="" +="b)" %3d="" %3d="" float="" z="(float)(n" (i="" +="" j))="" (float)(c);="" if="" (floor(z)="" {="" int="" x="int" y="" ceil(z))="" i="" a;="" j/="" b;="" maxval="max(maxVal," x="" +="" y="" (int)z);="" return="" maxval;="" }="" int="" main()="" {="" max="" cout="">< maxresult(="" );="" return="" 0;="" 1="" }="" input="" compilation="" failed="" due="" to="" fellowing="" ons="" main.cpp:7:23:="" error:="" 'n'="" was="" not="" declared="" in="" this="" scope="" 7|="" for="" (int="" i="0;" i=""><= n;="" i="" a)="" main.cpp:7:31:="" error:="" 'a="" was="" not="" declared="" in="" this="" scope="" for="" (int="" i="0;" i=""><= n;="" i="" t="a)" %3d="" main.cpp:9:36:="" error:="" b'="" was="" not="" declared="" in="" this="" scope="" |="" 6="" for="" (int="" j="0;" j=""><= n="" -="" i;="" j="" -="" b)="" %3d="" main.cpp:11:45:="" error:="" 'c="" was="" not="" declared="" in="" this="">

Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here