-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssSeries.java
More file actions
28 lines (24 loc) · 530 Bytes
/
AssSeries.java
File metadata and controls
28 lines (24 loc) · 530 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.tyss.corejava;
import java.util.Scanner;
public class AssSeries {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.println("give 3 inputs:");
int a=sc.nextInt();
int b=sc.nextInt();
int c=sc.nextInt();
int sum=a;
for(int i=0;i<c;i++) {
sum+=((Math.pow(2,i))*b);
System.out.println(sum);
}
/*
for(int i=0;i<c;i++) {
int result=0;
for(int j=0;j<=i;j++) {
result+=((Math.pow(2,j))*b);
}
System.out.println(a+result);
}*/
}
}