C 使用输出以下程序的循环编写程序
因此,我编写了一个程序,将度转换为弧度,然后将结果打印为输出C 使用输出以下程序的循环编写程序,c,printf,output,C,Printf,Output,因此,我编写了一个程序,将度转换为弧度,然后将结果打印为输出 CODE (website not phone friendly) #include <stdio.h> #define PI 3.141593 int main (){ int degrees =10; double radians; printf("Degrees to Radians \n"); while( degrees <= 360){
CODE (website not phone friendly)
#include <stdio.h>
#define PI 3.141593
int main (){
int degrees =10;
double radians;
printf("Degrees to Radians \n");
while( degrees <= 360){
radians = degrees*PI/180;
printf("%6i %9.6f \n", degrees, radians);
degrees +=10;
}
}
END CODE
code(网站对电话不友好)
#包括
#定义PI 3.141593
int main(){
整数度=10;
双弧度;
printf(“度到弧度”\n);
while(degrees以下是如何在代码中使用fprintf
int main() {
FILE * fp;
int degrees =10;
double radians;
printf("Degrees to Radians \n");
fp = fopen("radians.txt","w+");
while( degrees <= 360){
radians = degrees*PI/180;
printf("%6i %9.6f \n", degrees, radians);
fprintf(fp, "%6i\t%9.6f \n", degrees, radians);
degrees +=10;
}
return 0;
}
intmain(){
文件*fp;
整数度=10;
双弧度;
printf(“度到弧度”\n);
fp=fopen(“radians.txt”,“w+”);
而(度打印到stdout
?fprintf()
可能有点过头了。你知道如何使用转义序列吗?在字符串文本(“这是字符串文本”
)中,\n
表示换行符,\“
表示双引号,\\
表示反斜杠。使用这些表示可以将代码表示为字符串文字,然后可以像其他任何东西一样打印(使用put
或printf
或…).我试过了,但实际上我想做的是让程序成为输出。因此,当我运行程序时,实际输出是高于度到弧度转换的程序。