G. Summation from 1 to N – Codeforces Problem Solution in C

Disclaimer: Make sure you tried enough before checking the solution

Problem: https://codeforces.com/group/MWSDmqGsZm/contest/219158/problem/G

#include<stdio.h>
int main() {
    long long int i,s=0,a,nn;
    scanf("%lld",&a);
    for(i=1;i<=a;i++){
        nn = (a*(a+1))/2;
    }
    printf("%lld",nn);

    return 0;
}

Leave a Comment