Q2. Convert the following for loop to corresponding while loop:
for(int x=1,s=0; x<=25; x+=2)
S+=X, and quick
Answers
Answered by
1
int x=1,s=0;
while(x<=25)
{
s+=x;
x+=2;
}
Answered by
2
Question:-
➡ Convert the following for loop to while loop.
Solution:-
This is the converted code snippet.
int x=1,s=0;
while(x<=25)
{
s+=x;
x+=2;
}
Similar questions