10716 - Arithmetic Sequence
raw download clone
C
views 26
,
size 192 b
#include <stdio.h>

int main(void)
{
    int a, n, d, ans;

    scanf("%d%d%d", &a, &n, &d);
    ans = a + (n - 1) * d;
    printf("%d %d", ans, n * (a + ans) / 2);

    return 0;
}
close fullscreen
Login or Register to edit or fork this paste. It's free.