View Code of Problem 34

#include<stdio.h>
#include<stdbool.h>
#include<math.h>

int arithmeticSum(int n){
    return (n * (1 + n)) / 2; 
}
int main(){
    int a;
    while(scanf("%d",&a) != EOF){
        printf("%d\n",arithmeticSum(a));       
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 34