Rewrite the following while loops as for loops:
a) int i = 1;
while(i<=10)
{
if (i<5 && i !=2)
cout << 'X';
i++;
}
b) int i =1;
while(i<=10)
{
cout << 'X';
i = i + 3;
}
c) int n = 100;
do
{
cout << 'X';
n = n + 100;
}while(n < 1000);
a) for( int i=1; i<=10; i++)
if (i<5 && i !=2)cout << 'X';
b) for(int i=1; i<=10; i = i + 3)
cout << 'X';
c) for( int n = 100; n <1000; n = n + 100)
cout << 'X';
Computer Science & Information Technology
You might also like to view...
Explain how you can use a document template and placeholders.
What will be an ideal response?
Computer Science & Information Technology
The _______ sits on top of the fusing roller and lubricates it
Fill in the blank(s) with correct word
Computer Science & Information Technology
What is an RIP?
What will be an ideal response?
Computer Science & Information Technology
A 2-3-4 tree requires more storage than a binary search tree.
What will be an ideal response?
Computer Science & Information Technology