Pages

Write a program to print counting from 1 to 10 using for loop

Tuesday, 25 June 2013

#include <stdio.h>
#include <conio.h>
int main()
{
    int x;
    // The loop goes while x < 10, and x increases by one every loop
    for ( x = 0; x < 10; x++ ) {
        /* Keep in mind that the loop condition checks 
           the conditional statement before it loops again.
           consequently, when x equals 10 the loop breaks.
           x is updated before the condition is checked. */   
        printf( "%d\n", x );
    }
    getch();
}
 

Search Box

Most Reading

Contact Form

Name

Email *

Message *