请问在C语言中,开方函数sqrt()怎么用?麻烦给举个简单的例子,具体情况如下?

#include<stdio.h>
#include<math.h>
void main()
{
int a=25,s;
s=sqrt(a);
printf("s=%f",sqrt(25));

}

LINK : fatal error LNK1168: cannot open Debug/1.exe for writing
执行 link.exe 时出错.

为什么会有一个错误?

梵蒂冈之花
浏览 490回答 3
3回答

函数式编程

#include<stdio.h>#include<math.h>void main(){&nbsp; &nbsp;double a=25,s;&nbsp; &nbsp; s=sqrt(a);&nbsp; &nbsp; printf("s=%.2lf\n",s);}sqrt的原型:double sqrt(double x),输出格式是%lf,你在看看

阿波罗的战车

#include<bits/stdc++.h>using namespace std;int main(){int x;cin>>x;double e=sqrt(x);cout<<e<<endl;return 0;}此为万能头的模板,更简单些

肥皂起泡泡

#include<stdio.h>#include<math.h>void main(){float a=25,s;s=sqrt(a);printf("s=%f",s);} 正确程序如上&nbsp;
打开App,查看更多内容
随时随地看视频慕课网APP