/*
求Sn = a + aa + aaa + aaaa + ....其中a为一个数字,一共有n项。a和n由用户键盘输入。
*/ #include <stdio.h>
#include <stdlib.h> void anFunc()
{
int Sn =0,p = 0;
int a,n;
printf("Enter a:\n");
scanf("%d", &a);
printf(("Enter n:\n"));
scanf("%d", &n);
while(n--)
{
p = p*10 + a;
Sn = Sn + p;
}
printf("%d", Sn);
} int main()
{
anFunc();
return 0;
}

最新文章

  1. 用Python制作新浪微博爬虫
  2. jquery实现轮播图
  3. C语言学习008:标准错误
  4. 【HTML】字符(Glyphs)收集
  5. zencart资源
  6. Spring学习总结(1)——Spring AOP的概念理解
  7. codeforces 432 B Football Kit
  8. 牛客_Java_值传递(拷贝)不该表原来变量+传引用的话会一起改变
  9. linux之uniq
  10. spring02IOC
  11. GridView下DropDownList 的选择方法onselectedindexchanged 实现方法
  12. Yogurt factory(POJ 2393 贪心 or DP)
  13. vector 汇总
  14. Codeforces 110B-Lucky String(技能)
  15. Android -- 从源码的角度一步步打造自己的TextView
  16. 用greenlet实现Python中的并发
  17. 51nod 1686 第k大区间
  18. [日常]总结2016年7月入职至2016年7月26号微盘所遇bug
  19. router-link 自定义点击事件
  20. Linux网络编程学习计划

热门文章

  1. python一行代码格式化日期
  2. C++基础入门:C++初始
  3. FileInputStream字节输入流
  4. 算法:Manacher,给定一个字符串str,返回str中最长回文子串的长度。
  5. 传输层协议(tcp ip和udp 三次握手 四次握手)
  6. 【微服务】- Nacos - 注册中心
  7. kratos v2版本命令行工具使用
  8. 使用 Elastic 技术栈构建 K8S 全栈监控 -2: 用 Metricbeat 对 Kubernetes 集群进行监控
  9. CentOS7使用yum方式安装Containerd
  10. 跳转控制语句break