[코드업] 기초 100제 Java로 풀기 - 1091

곽준영·2023년 2월 24일
0
package codeup_100;

import java.util.Scanner;

public class codeup_91 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int m = sc.nextInt();
		int d = sc.nextInt();
		int n = sc.nextInt();
		int result = a;
		for(int i=2; i<=n; i++) {
			result = result*m+d;
		}
		System.out.println(result);
	}
}
profile
I want to become a versatile freelancer programmer💻

0개의 댓글