首页 > 学院 > 开发设计 > 正文

多项因式相加

2019-11-06 08:25:09
字体:
来源:转载
供稿:网友

例如:2+22+222+2222=?

输入因式和相加个数,输出总和

#include<stdio.h>#include<stdlib.h>int main(){	int a,n;	int count=0,sn=0,tn=0;	scanf("%d%d",&a,&n);	while(count<n)	{		tn=tn+a;		sn=sn+tn;		a=a*10;		count++;	}	PRintf("a+aa+..=%d",sn);	system("pause");}


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表