MeshWorld India LogoMeshWorld.
ProgramC1 min read

Sum of Series Between Two Numbers Using For Loop in C

Vishnu
By Vishnu
Sum of Series Between Two Numbers Using For Loop in C

A program to find sum of series between two integers numbers illustrating for loop in C - language

Working example

/**
 * Sum Of Series Between Start To End Values
 * Using For Loop
 */
#include <stdio.h>
int main()
{
    int i, start, end, result = 0;
    printf(" Enter start & end number: ");
    scanf("%d %d", &start, &end);
    printf("\n Start value : %d", start);
    printf("\n End value : %d", end);

    for (i = start; i <= end; i += 1)
    {
        //printf("\n I : %d", i);
        //printf("\n Result B4 adding : %d", result);
        result = result + i;
        //printf("\n Result : %d", result);
    }
    printf("\n Sum of series : %d", result);
    printf("\n");
    return 0;
}

Output

Enter start & end number: 12 24

Start value : 12
End value : 24
Sum of series : 234
Share_This Twitter / X
Vishnu
Written By

Vishnu

Founder & Principal Architect at MeshWorld. Senior engineer and instructor specializing in AI agent systems, scalable web architecture, and modern development workflows.

Enjoyed this article?

Support MeshWorld and help us create more technical content