InterviewSolution
Saved Bookmarks
| 1. |
The following code has some error(s). Rewrite the correct code underlining all the correction made:Int k=2;sum = 0;//Declaring k and sum as Integerdo{sum=k; k+=2;}while(k= <20)jTextField1(Integer.tostring(sum)); |
|
Answer» int k = 2; sum = 0; //could also be written as int k = 2; int sum = 0; do { sum=k; // could also be written as sum = sum + k; k + = 2; } while(k< =20); jTextField1.setText(Integer.toString(sum)) ; |
|