Â
In this, we are going to write a program to find the sum of n integers with the help of C programming language.#include <stdio.h>
#include <math.h>
int main()
{
int n, sum;
printf("Enter the number till where you want the sum: ");
scanf("%d", &n);
sum = n * (n + 1) / 2.0;
printf("Sum of the integers = %d\n", sum);
return 0;
}
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP