ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software»
  • Computer Science & Programming

sum of first 10 natural numbers using c programming

Updated on March 22, 2010

In computer programming, C language is very effetive. In the sense, using 'c', we can see the hard disk address with the help of pointers. I will publish some simple pointer progarammes later.



void main()



int i,sum=0;

for(i=1;i<=10;i=i+1) // starting for loop, this loop will execute until the value of i reaches 10.


sum=sum+i; // add the values of sum with i and save it to sum itself.


printf("Sum of first 10 natural numbers is %d", sum);




NB: stdio.h & conio.h ----> header files

clrscr() ---> for clearing the screen

printf() ----> for printing the result.

getch() ----> screen will wait until a key is pressed.

------> for running the program press Ctrl + F9 key together, it will compile & run the program


thanks a lot.

hope u get the result. :-)


    0 of 8192 characters used
    Post Comment

    • profile image

      anandhan 24 months ago


    • profile image

      Sanjay Netriwal 2 years ago

      Thank You

    • profile image

      ankit 3 years ago

    • profile image

      shubhendu 3 years ago

      why did we take sum=0;

    • profile image

      Shubham 3 years ago

      THANK U

    • profile image

      parri 3 years ago

      Thanks a lot to solving my problem..

      Thanku very much

    • profile image

      ArUn 3 years ago

      Thnx a lot solving my problm.Bcz i was in big confused 0 is prime number or natural number. ..

      Here i saw,nd my problem is solved....


    • profile image

      iqra 3 years ago

      how to find this problem

      take two numbers, a and b as input and find axb(their product)without using the operator

    • profile image

      prsad joshi 4 years ago

      i want its algorithm.......

    • profile image

      biswajit majumder 4 years ago

      Thanks a lot for preparing Easyly

    • profile image

      saba 4 years ago


    • profile image

      muthu 4 years ago

      thank u for urgood presentation

    • profile image

      rofi 4 years ago

      thank u

    • profile image

      reud 4 years ago

      big fake

    • profile image

      reud 4 years ago

      big fake

    • profile image

      harish 4 years ago

      dear sir,

      please send program add 10 number add 10 number and find averaqge using arrays sort the n number using array

      4.add 10 number using ponter with arrays

      5.sort the n number using ponters

      my email id is

    • profile image

      bhavani 4 years ago

      It's nice

    • profile image

      swetha. 5 years ago

      easy to understand..thanks

    • profile image

      bilal ahmed 5 years ago

      i like it

    • profile image

      siri 6 years ago

      dear sir,plz send me the programe for replacing the string by using files............

    • profile image

      your code is incorrect 6 years ago

      your code is incorrect

    • profile image

      Shivendra 7 years ago