+ 2

Rewrite using for loop and do while loop in java

int I=1, j=2; while (I<=25) { I++; j=j+2; }

10th Sep 2019, 3:35 PM
Dinesh Kumar
Dinesh Kumar - avatar
4 Réponses
+ 2
int i=1,j=2; do { i++; j+=2; }while(i<=25);
10th Sep 2019, 3:45 PM
KfirWe
KfirWe - avatar
+ 3
int i=1,j=2; for(i;i<=25;++i) { j+=2; }
10th Sep 2019, 3:42 PM
KfirWe
KfirWe - avatar
+ 1
int i=1, j=2; for( ;i<=25; i++, j+=2);
10th Sep 2019, 7:56 PM
zemiak
0
int j = 2; int end = 25; j += 2 * (end + 1);
10th Sep 2019, 3:42 PM
Anton Böhler
Anton Böhler - avatar