Rewrite the program using for loop.
int i=10;
do
{
System.out.println("I love Java");
i++;
} while(i<10);
Rewrite the following code using while loop.
final int N = 15;
for(int i=0, sum =0; i
sum += i;
System.out.println("Sum = "+sum);
Answers
Answered by
1
Answer:
Using For Loop:
for(i=0;i<10;i++){
System.out.println("I Love Java");
Using While Loop:
final int N=15;
int i=0;
int sum=0;
Sum+=i;
while (sum<=N)
System.out.println("Sum =" +sum);
i++;
Similar questions