展开全部
回答即可得2分经验值,回答被选为满意回#include <stdio.h>
#define N 10 /*最后一项中1的个数*/
int main()
{
int i;
long term, sum;
term = 1;
sum = 0;
for (i = 1; i <= N; ++i)
{
sum += term;
term = term*10+1;
}
printf("%ld\n", sum);
return 0;
}
如果最后一项中1的个数超过10个,就不能用这种方法了。
大过年的就帮你写了吧。另外VB不是语言,而是编程环境。BASIC才是语言。
BASIC代码如下:
Public Function Add(N As Integer) As Long
term As Long
sum As Long
term = 1
sum = 0
For i = 1 To N
sum = sum + term
term = term*10+1
Next i
Add = sum
End Function答可同步增加经验值和财富值
#define N 10 /*最后一项中1的个数*/
int main()
{
int i;
long term, sum;
term = 1;
sum = 0;
for (i = 1; i <= N; ++i)
{
sum += term;
term = term*10+1;
}
printf("%ld\n", sum);
return 0;
}
如果最后一项中1的个数超过10个,就不能用这种方法了。
大过年的就帮你写了吧。另外VB不是语言,而是编程环境。BASIC才是语言。
BASIC代码如下:
Public Function Add(N As Integer) As Long
term As Long
sum As Long
term = 1
sum = 0
For i = 1 To N
sum = sum + term
term = term*10+1
Next i
Add = sum
End Function答可同步增加经验值和财富值
展开全部
#include <stdio.h>
#define N 10 /*最后一项中1的个数*/
int main()
{
int i;
long term, sum;
term = 1;
sum = 0;
for (i = 1; i <= N; ++i)
{
sum += term;
term = term*10+1;
}
printf("%ld\n", sum);
return 0;
}
如果最后一项中1的个数超过10个,就不能用这种方法了。
大过年的就帮你写了吧。另外VB不是语言,而是编程环境。BASIC才是语言。
BASIC代码如下:
Public Function Add(N As Integer) As Long
term As Long
sum As Long
term = 1
sum = 0
For i = 1 To N
sum = sum + term
term = term*10+1
Next i
Add = sum
End Function
#define N 10 /*最后一项中1的个数*/
int main()
{
int i;
long term, sum;
term = 1;
sum = 0;
for (i = 1; i <= N; ++i)
{
sum += term;
term = term*10+1;
}
printf("%ld\n", sum);
return 0;
}
如果最后一项中1的个数超过10个,就不能用这种方法了。
大过年的就帮你写了吧。另外VB不是语言,而是编程环境。BASIC才是语言。
BASIC代码如下:
Public Function Add(N As Integer) As Long
term As Long
sum As Long
term = 1
sum = 0
For i = 1 To N
sum = sum + term
term = term*10+1
Next i
Add = sum
End Function
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
什么语言?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询