C语言编程

[复制链接]
查看11 | 回复4 | 2009-12-7 20:15:17 | 显示全部楼层 |阅读模式
循环变量不能用double
回复

使用道具 举报

千问 | 2009-12-7 20:15:17 | 显示全部楼层
改为double x,s=0;int n;试试
回复

使用道具 举报

千问 | 2009-12-7 20:15:17 | 显示全部楼层
同上,for(int x,x<n,x++)n也要是整数!
回复

使用道具 举报

千问 | 2009-12-7 20:15:17 | 显示全部楼层
#include"stdio.h"#include"math.h"void main(){double x,s=0;int n;//循环变量需要用int scanf("%d",&n);for(x=1;x<=n;x++){s=+pow(x,x);printf("%lf\n",s);}}
回复

使用道具 举报

千问 | 2009-12-7 20:15:17 | 显示全部楼层
#include"stdio.h"#include"math.h"void main(){double x,s=0, n;scanf("%lf",&n);for(x=1;x<=n;x++){s=s+pow(x,x);printf("%lf\n",s);}}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行