#include <stdio.h>
int main(){
int a=1;
int d=0;
int n=0;
scanf("%d %d %d", &a, &d, &n);
int sum=a;
int k=1;
while(n>k){
sum=sum+d; // 1, 4, 7,
k++;
}
printf("%d",sum);
}
a=1, d(등차)=3, n=5번째 수
1 4 7 10 13 ...
a=25, d=-2
25 23 21 19 17 ...
a=2 r(등비)=3 n=7
2 6 18 54 162 ...
To embed this project on your website, copy the following code and paste it into your website's HTML: