In this article I would like to share with you a sample program that will display a series of even numbers using for loop statement in C. The difference in this program is that the initializer is outside the for loop statement in C. The code is very short and easy to understand.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
Sample Program Output
Program Listing
#include <stdio.h>
int main()
{
int counter=0;
counter = 2;
printf("\tInitializer Outside the For Statement in C");
printf("\n\n");
for( ; counter <=40; counter = counter +2)
{
printf(" %d ",counter);
}
printf("\n\n");
printf("\t End of Program ");
printf("\n\n");
}
No comments:
Post a Comment