打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
求一系列数的和
using System;
 
class Class1
{
 
public static int x;
 
public static int y;
 
public static long temp=0;
 
public static long sum=0;
 
public static void Main()
 
{
  
Console.WriteLine ("请输入所要求这一系列数的和的个数:");
  
x=int.Parse (Console.ReadLine ());
  
Console.WriteLine ("请输入这一系列数的基数:");
  
y=int.Parse (Console.ReadLine ());
  
for(int i=1;i<=x;i++)
  
{
   
int temp=y;
     
  
for(int j=1;j<i;j++)
   
{
       
temp=temp*10+y;
   
}
   
sum+=temp;
  
}
  
Console.WriteLine (sum);
  
Console.Read();
 
}
}  
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
BP网络模型的实现(C#)
C#简明教程(三)
C# 06.求正整数各位数字之和
C#基础知识系列一(goto、i++、三元运算符、ref和out、String和string、重载运算符)
彻底弄懂C#中delegate、event、EventHandler、Action、Func的使用和区别
C# 递归算法!(n多举例)
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服