# C program to find sum of all numbers from 0 to N without using loop

Here, we are implementing a **C program that will be used to find the sum of all numbers from 0 to N without using loop**.

Submitted by **IncludeHelp**, on September 04, 2018

Given the value of *N* and we have to find sum of all numbers from 0 to *N* in C language.

To **find the sum of numbers from 0 to N**, we use a mathematical formula: N(N+1)/2

**Example:**

Input:
Enter value of N: 5
Logic/formula:
sum = N*(N+1)/2 = 5*(5+1)/2 =5*6/2 = 15
Output:
sum = 15
Input:
Enter value of N: 10
Logic/formula:
sum = N*(N+1)/2 = 10*(10+1)/2 =10*11/2 = 110/2 = 55
Output:
sum = 55

Program:

need an explanation for this answer? contact us directly to get an explanation for this answerOutput