/* *Student: S.K Soekhlal * Number: 4860632 * Assignment: 1.4 */ #include #include #include int main(){ double a,r,b=0,sum=0; /*Declaring variables*/ int N; scanf("%lf%d%lf",&a,&N,&r); /*Storing inputted values in variables*/ for(;N>=0;--N){ /*Starting for loop to calculate sum*/ b = a * (pow(r,N)); /*calculating sum*/ sum += b; } printf("%.2f\n", sum); /*Printing sum on the screen*/ return 0; }