Rewrite the following while loops as for loops:

a) ```
int i = 1;
while(i<=10)
{
if (i<5 && i !=2)
cout << 'X';
i++;
}
```

b) ```
b) int i =1;
while(i<=10)
{
cout << 'X';
i = i + 3;
}
int n = 100;
do
{
cout << 'X';
n = n + 100;
}while(n < 1000);
```


```
for( int i=1; i<=10; i++)
if (i<5 && i !=2)
cout << 'X';
for(int i=1; i<=10; i = i + 3)
cout << 'X';
```

a) for( int n = 100; n <1000; n = n + 100)
cout << 'X';

Computer Science & Information Technology

You might also like to view...

Estimate the time in milliseconds to commit a transaction in your local DBMS.

What will be an ideal response?

Computer Science & Information Technology

The ________ is an early computer created in 1951, which was used to predict election results

A) UNIVAC B) ENIAC C) Colossus D) Harvard Mark 1

Computer Science & Information Technology

If you don't name a photo album, Facebook will use the title Unnamed Album

Indicate whether the statement is true or false

Computer Science & Information Technology

Parameter criteria are always entered within ____.

A. (Parentheses) B. {Curly brackets} C. [Square brackets] D.

Computer Science & Information Technology