Figure 1
Hope now you have a little idea about this flow chart. Here if the
statement is true it go inside the loop and if the statement is false it will
be end. To use this for loop you have to use an initialized counter.
for(count
= 0; count < 10; count++){
//statements to execute when the counter is less than 10
//statements to execute when the counter is less than 10
}
OK This is an simple example which use for loop to print even numbers
from 0 to 10.
Here you need not only for loop knowledge. You need also if else
statement to check whether the number is even or not.
Figure 2
Look the output is here…
Figure 3
Comments
Post a Comment