Review: Loops (b)
Instructions: Think about each question and write the answer in your notebook.
White Box Testing
1. Fix the errors in this C source code. There are 2 errors.
|
#include <stdio.h>
void main( )
{
int loop;
for(loop = 1; loop < 9; +loop)
printf("\nThis is a simple for loop.")
}
|
2. Fix the errors in this C source code. There are 2 errors.
|
#include <stdio.h>
void main( )
{
int count;
for(count = 1; count > 3; ++count)
printf("nRemember to buy bread today.");
}
|
3. Fix the errors in this C source code. There are 2 errors.
|
#include <stdio.c>
void main( )
{
int count;
printf("\nMemorize this for the geography test today:");
for count = 1; count < 8; ++count)
printf("\nTaskent is the capital of Uzbekistan.");
}
|
4. Fix the errors in this C source code. There are 2 errors.
|
#include <stdio.h>
void main( )
{
int i
printf("\nMemorize this for the geography test today:");
for(i = 1; i < 8; ++j)
printf("\nMontevideo is the capital of Uruguay.");
}
|