C 练习实例18
C 语言教程
· 2019-02-21 16:28:05
题目:求s=a+aa+aaa+aaaa+aa...a的值,其中a是一个数字。例如2+22+222+2222+22222(此时共有5个数相加),几个数相加有键盘控制。
程序分析:关键是计算出每一项的值。
实例
// Created by www.codercto.com on 15/11/9.
// Copyright © 2015年 码农教程. All rights reserved.
//
#include<stdio.h>
int main()
{
int s=0,a,n,t;
printf("请输入 a 和 n:\n");
scanf("%d%d",&a,&n);
t=a;
while(n>0)
{
s+=t;
a=a*10;
t+=a;
n--;
}
printf("a+aa+...=%d\n",s);
return 0;
}
以上实例输出结果为:
请输入 a 和 n: 2 5 a+aa+...=24690
点击查看所有 C 语言教程 文章: https://codercto.com/courses/l/17.html
Neural Networks for Applied Sciences and Engineering
Samarasinghe, Sandhya / CRC Pr I Llc / 2006-9 / $ 118.59
In response to the exponentially increasing need to analyze vast amounts of data, Neural Networks for Applied Sciences and Engineering: From Fundamentals to Complex Pattern Recognition provides scient......一起来看看 《Neural Networks for Applied Sciences and Engineering》 这本书的介绍吧!