#include<stdio.h>
#include<conio.h>
main()
{
int i;
clrscr();
printf("\n================== Ascending Order========================\n");
{
printf("\n %d",i);
}
printf("\n================== Descending Order========================\n");
for(i=10;i>=1;i--)
{
printf("\n %d",i);
}
getch();
}
----------------------------------------------------------------------
There are three parts that are separated by semi-colons in control block of the Cfor loop.
initialization_expression is executed before execution of the loop starts. The initialization_expression is typically used to initialize a counter for the number of loop iterations. You can initialize a counter for the loop in this part.
The execution of the loop continues until the loop_condition is false. This expression is checked at the beginning of each loop iteration.
The increment_expression, is usually used to increase (or decrease) the loop counter. This part is executed at the end of each loop iteration.


No comments:
Post a Comment