03D-2017 – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Exam Questions-ICSE2017-03D #JAVA#7237    siteicon   siteicon  

Problem Statement - 03D-2017

Convert following do-while loop into for loop.
int i=1;
int d=5;
do{
  d=d*2
  System.out.println(d);
  i++;
  }while(i<=5);

Solution

TC++ #7237

for(int i=5, d=5; i<=5; i++) { d = d * 2; System.out.println(d); }


Share

CSKC| Created: 15-Apr-2019 | Updated: 15-Apr-2019|ICSE2017









Back