c语言求80+2的y次方是否为完全平方数有错误吗?

问题描述:

c语言求80+2的y次方是否为完全平方数有错误吗?
#include
#include
#include
main()
{
int x,i=1;
float n,m;
scanf("%d",&x);
n=80+pow(2,x);
m=sqrt(n);
printf("%d\n",m);
if ((m%1)==0)
printf("%d可以\n",x);
else printf("\n");
i=++i;
x=++x;
do i>99;
system("pause");
return 0;
}
1个回答 分类:综合 2014-09-22

问题解答:

我来补答
注释的地方有错,修改过后可运行了,你看看
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
main()
{      
       int x,i=1;      
       float n,m;      
       scanf("%d",&x);      
       n=80+pow(2.0,x);      
       
       m=sqrt(n);      
       printf("%f\n",m);      
       
       if ((int)m == m)  //条件改一下    
          printf("%d可以\n",x);      
       else 
            printf("%d不可以\n",x);      
       //这几句干什么的?     
      // i=++i;      
      // x=++x;      
       
      // do i>99;      
       
       system("pause");      
       return 0;      
}
 
 
展开全文阅读
剩余:2000
下一页:格子里面填一下