Computer Science, asked by tushar263, 1 year ago

rewrite the following for loops by using while and do while loops

Attachments:

Answers

Answered by ferisha1809
19
1. // using while loop
i=1;
i=1;
while(i<=10)
{
System.out.println(i*j);
i++;
j++;
}
//using do while loop
i=1;
j=1;
do
{
S.O.pln(i*j);
i++;
j++;
}
b.//using while loop
int p=20;k=p;
while(k>=0)
{
s+=k;
k-=2;
}
System.out.println("sum="+s);
//using do while loop
int p=20;k=p;
do
{
s+=k;
k-=2;
}while(k>=0);
S.o.pln("sum="+s);
hope it helps.....!!!!
Similar questions