#include stdio.h
創(chuàng)新互聯(lián)建站主營(yíng)樅陽(yáng)網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營(yíng)網(wǎng)站建設(shè)方案,App定制開(kāi)發(fā),樅陽(yáng)h5成都微信小程序搭建,樅陽(yáng)網(wǎng)站營(yíng)銷(xiāo)推廣歡迎樅陽(yáng)等地區(qū)企業(yè)咨詢(xún)
void main()
{ float q[50]={0};
double sum=1.0;
int n[50]={0};
int i=0;
int x=0;
int y=0;
while(i2)
{scanf("%d %f",n[i],q[i]);
i++;
}
for(i=0;i50;i++)
{
if(0==q[i])
break;
}
double dum=0;
for(x=0;xi;x++)
{for(y=0;yn[x];y++)
{
sum=1+sum*q[x];
}
printf("%0.3f\n",sum);
sum=1;
}
}
#include?stdio.h
int?main()?{
int?target?=?10000000;
int?sum?=?0,?i?=?0;
while?(sum??target)?{
i++;
sum?=?sum?*?2?+?1;
}
printf("第%d天存款達(dá)到1000萬(wàn)\n存款總額%d\n",?i,?sum);
}
#include?stdio.h
int?main()?{
int?m,?n,?i;
int?product?=?1;
printf("輸入一個(gè)數(shù)M:");
scanf("%d",?m);
printf("輸入一個(gè)數(shù)N:");
scanf("%d",?n);
printf("%d?到?%d?的和:%d\n",?m,?n,?(m?+?n)*(n?-?m?+?1)?/?2);
for?(i?=?m;?i?=?n;?i++)?{
product?*=?i;
}
printf("%d?到?%d?的積:%d\n",?m,?n,?product);
}
代碼文本:
#include "stdio.h"
int main(int argc,char *argv[]){
int n,s,i,t;
printf("Enter n(int 0n)...\nn=");
if(scanf("%d",n)!=1 || n1){
printf("Input error, exit...\n");
return 0;
}
for(s=0,t=1,i=0;in;s+=t*=2,i++);
printf("The result is %d.\n",s);
return 0;
}
//VC 6.0 運(yùn)行很好,TC不知道,按照TC模式寫(xiě)的
#includestdio.h
int main()
{
long int sum = 0,i = 0,t = 1;
while(i= 20) {
sum += t;
t *= 2;
i ++;
}
printf("%ld\n",sum);
}
#includestdio.h
#includemath.h
void main()
{
int a,n,q,i;
double m,s=0;
printf("請(qǐng)輸入a,n,q ");
scanf("%d,%d,%d",a,n,q);
for(i=0;in;i++)
{
m=a*pow(q,i);
s+=m;
}
printf("%lf\n",s);
}pow函數(shù)沒(méi)定義,要加math.h頭文件s沒(méi)有初始化,要加初始值s=0循環(huán)部分也有問(wèn)題,具體如上