C Programming Related Problem 03

Write down a C program Code which shows the summation of nth number of series --- 

 1 + 2 + 3 + ……………+ n.


Following Coding(Using For Loop)

#include <stdio.h>

int main ()

{

    int i , n, sum = 0;

    printf("Enter the Value :");

    scanf ("%d", &n);

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

        {

            sum = sum + i ;

        }

        printf("%d", sum);

        return 0;

}

Comments

Popular posts from this blog

Hajir Biriyani with recipes

Freelancing

Python Programming Language & Used for