Diiwali oDeepavali is the Hindu festival of lights celebrated every year in autumn in the northern hemisphere.
Mayank is excited about Diwali and he asked money from his dad for buying crackers. His dad told him that he will be giving him money in splits and will give money every day in a splitted amount so that on the day before the Diwali , Mayank will have the total money to buy the crackers.



Input

3
10 3 5
2 3 4
1 0 3

Output

22
11
1
.
Solution
import java.util.Scanner;
class TestClass {
public static void main(String args[] ) throws Exception {
int T,a,k,n,su=0;
Scanner s=new Scanner(System.in);
T=s.nextInt();
for(int i=0;i<T;i++)
{ a=s.nextInt();  k=s.nextInt();  n=s.nextInt();
su=a+k*(n-1);
System.out.println(su);
}
}
}



if you have any problem in this code, take a screen shot and contact with Rishabh Chaubey.

Post a Comment

Previous Post Next Post