#include <stdio.h> #include <stdlib.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char *argv[]) { int n,i,j; double m,sum=0; scanf("%lf %d",&m,&n); for(i=0;i<n;i++){ sum=sum+m+m/2; m=m/2; } printf("%.2lf %.2lf",m,sum-m); return 0; } |
Double click to view unformatted code.