等差数列的前n项和

#include<stdio.h>

int main(int argc, char const *argv[])
{
    
    int in_num=0;
    int a1=2, d=3;
    int an=0, out_sum=0;

    while (scanf("%d", &in_num) != EOF)
    {
        out_sum=0;
        an=0;
        an = a1 + (in_num - 1)*d;
        out_sum = (a1 + an)* in_num/2;
        printf("%d\n", out_sum);
    }
    
    return 0;
}