sum of first 10 natural numbers using c programming

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. :-)

Comments 22 comments

Shivendra 6 years ago

your code is incorrect 4 years ago

your code is incorrect

siri 4 years ago

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

bilal ahmed 4 years ago

i like it

swetha. 4 years ago

easy to understand..thanks

bhavani 3 years ago

It's nice

harish 3 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

reud 3 years ago

big fake

reud 3 years ago

big fake

rofi 3 years ago

thank u

muthu 3 years ago

thank u for urgood presentation

saba 3 years ago


biswajit majumder 3 years ago

Thanks a lot for preparing Easyly

prsad joshi 2 years ago

i want its algorithm.......

iqra 2 years ago

how to find this problem

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

ArUn 2 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....


parri 2 years ago

Thanks a lot to solving my problem..

Thanku very much

Shubham 2 years ago


shubhendu 23 months ago

why did we take sum=0;

Sanjay Netriwal 15 months ago

Thank You

anandhan 9 months ago


    Sign in or sign up and post using a HubPages Network account.

    0 of 8192 characters used
    Post Comment

    No HTML is allowed in comments, but URLs will be hyperlinked. Comments are not for promoting your articles or other sites.

    Click to Rate This Article