Technology has advanced to the point where programming has become an essential part of our lives. We use software and applications for communication, entertainment, education, and work, and these are all built on programming languages.

Program to print sum of first ten natural numbers


Explanation
Here the variable s denotes to sum and is initialized with value 0. When the loop begins, the s adds the value of i with its previous values along with the loop.When the loop terminate, the last sum is stored in s and is printed outside of the loop.


Output


Share:

1 comment:

If you have any doubt, let me know...

Translate

Wikipedia

Search results