File size: 249 Bytes
c574d3a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
public class Mult{
// a+(n-1)*d;
static void mul(int a,int b,int n){
int k = a+(n-1)*(b-a);
System.out.println(k);
}
public static void main(String[] args){
int n = 4;
int a = 2;
int b = 3;
mul(a,b,n);
}
}
|