Print 1 to 10 using for loop - C Programming



/***************************************************************
 Statement - Print 1 to 10 using for loop
 Programmer - Vineet Choudhary
 Written For - http://developerinsider.co
 Compiler - gcc
 ***************************************************************/


#include <stdio.h>


int main()
{
    int i;

    /* The loop goes while i < 10, and i increases by one every loop*/

    for ( i = 0; i < 10; i++ ) {
        printf( "%d\n", i );
    }
}

/*
Output:
0
1
2
3
4
5
6
7
8
9
*/

Compilers -

  1. Compile C program with gcc compiler on Bash on Ubuntu on Windows 10
  2. Compile C++ program with g++ compiler on Bash on Ubuntu on Windows 10
  3. Turbo C++
  4. C/C++ Compiler (gcc) for Android - Run C/C++ programs on Android
You've successfully subscribed to Developer Insider
Great! Next, complete checkout for full access to Developer Insider
Welcome back! You've successfully signed in
Success! Your account is fully activated, you now have access to all content.