Sunday, January 20, 2019

C Program To Print First 10 Natural Numbers


Print 10 Natural Numbers:-
In this c program we will print first 10 natural numbers by using for loop. Here we take a int type variable, name as num for counter. We initialize with 1 and increment the value of num,  break loop when reached 10 by giving condition num<=10.

   /*
      Program : 10 Natural Numbers
      Filename : naturalNumber.c
      IDE Used To Developed : CodeBlocks
      Developed By : Pavito Golui
   */
  #include<stdio.h>
  int main()
   {
      int num;
       for(num=1;num<=10;num++)
         {
             printf("%d \n",num);
         }
       return 0;
    }
 

Output :

  1
  2
  3
  4
  5
  6
  7
  8
  9
  10

0 comments:

Welcome to you in All Coding Help