C++ Program to print the natural number .Natural numbers, which include all positive integers from 1 to infinity, are a part of the number system. Natural numbers, which do not include zero or negative numbers, are also known as counting numbers. They are only positive integers, not zero, fractions, decimals, or negative numbers, and they are a part of real numbers.

#include <iostream>

using namespace std;

int main()

{

int i, n, sum = 0;

cout << "Enter the positive number ";

cin >> n;

for (i = 1; i <= n; ++i)

{

sum += i;

}

cout << "Sum = " << sum;

return 0;

}

Output:

Enter the positive number 45

Sum = 1035

## Zero is natural number or not

Some mathematicians regard zero to be a natural number due to its status as a whole number and the fact that it is not a negative number. To answer the question, yes, zero is a natural number on a number line and when identifying numbers in a set; nevertheless, it is not used to count objects.

## += operator in c++ programming

### Similar Programs

Java program to find the middle element of the string

Java program to find the cubes of an n natural numbers

Java program to print weekdays using a switch statement

Java program to solve quadratic equation using if-else

Java program calculation to fill the bucket with the water mug

Method Overloading in Java to Find Arithmetic Sum of 2 or 3 or 4 Variables by Passing Argument

Write a java program to print the nested methods to perform mathematical operations

Write a program to concatenate two string in java

Write a program to find second largest number in an array in java

Write a java program to find the odd or even number in the array

Write a java program to add element in user-specified position using array

Write a java program to delete an element from an array list at the specified index

Write a java program to arrange strings in alphabetical order

Write a java program to split an array in a specific position

Write a array program to calculate average and sum in java

Write a program to calculate electricity bill in java

Find out duplicate number between 1 to n numbers in java

Program in java to print the pie value(pi)

Java program to print the element using calling methods in the same class