标签:main logs print code oat style scanf 技术 技术分享
1 #include<stdio.h> 2 int main() 3 { 4 int n,i,t; 5 float q,s; 6 while(scanf("%d%f",&n,&q)==2) 7 { 8 if (n>=2&&n<=20&&q>0&&q<2) 9 { 10 s=0; 11 for (i=0;i<=n;i++) 12 { 13 s=s+pow(q,i); 14 } 15 printf("%.3f\n",s); 16 } 17 } 18 19 }
标签:main logs print code oat style scanf 技术 技术分享
原文地址:http://www.cnblogs.com/domen0814/p/6806377.html