#include <stdio.h>
int main()
{
char c = 'a';
int n =c; //将c赋值给n
float f = n; //将c赋值给f
double d = f; //将c赋值给d
printf("%d\n",n);
printf("%f\n",f);
printf("%lf\n",d);
return 0;
}
int main()
{
char c = 'a';
int n =c; //将c赋值给n
float f = n; //将c赋值给f
double d = f; //将c赋值给d
printf("%d\n",n);
printf("%f\n",f);
printf("%lf\n",d);
return 0;
}
2021-12-06
#include <stdio.h>
int main(){
int age = 18;
float height = 1.85;
char unit = 'm';
printf("小明今年%d岁\n", ("%d",age));
printf("小明身高%f%c\n",("%f",height),("%c",unit));
printf("%s","小明现在在慕课网上学习IT技术");
return 0;
}
运行成功
int main(){
int age = 18;
float height = 1.85;
char unit = 'm';
printf("小明今年%d岁\n", ("%d",age));
printf("小明身高%f%c\n",("%f",height),("%c",unit));
printf("%s","小明现在在慕课网上学习IT技术");
return 0;
}
运行成功
2021-12-04
这样子就可以通过了
#include <stdio.h>
int main()
{
printf("**************\n");
printf("I love imooc\n");
printf("good good study!\n");
printf("day day up!\n");
printf("**************\n");
return 0;
}
// extern
#include <stdio.h>
int main()
{
printf("**************\n");
printf("I love imooc\n");
printf("good good study!\n");
printf("day day up!\n");
printf("**************\n");
return 0;
}
// extern
2021-12-03
int sxh;
int g , s , b ;
for(sxh = 100 ; sxh < 1000; sxh++)
{
g = sxh%10;
s = sxh/10%10;
b = sxh/100;
if(g*g*g+s*s*s+b*b*b ==sxh)
{
printf("水仙话数学:%d\n",sxh);
}
}
return 0;
}
int g , s , b ;
for(sxh = 100 ; sxh < 1000; sxh++)
{
g = sxh%10;
s = sxh/10%10;
b = sxh/100;
if(g*g*g+s*s*s+b*b*b ==sxh)
{
printf("水仙话数学:%d\n",sxh);
}
}
return 0;
}
2021-11-26
#include <stdio.h>
int main()
{
选择你们认为最合理的循环结构完成功能吧 */
int sum = 0; //定义计算结果变量sum
int i = 1; //定义循环数字变量i
int flag = 1; //定义符号状态变量flag
//使用for循环
for(i=1;i<=100;i++)
{
sum=sum+(i%2-1)*i+(i%2)*i;
}
printf("sum=%d\n",sum);
return 0;
}
int main()
{
选择你们认为最合理的循环结构完成功能吧 */
int sum = 0; //定义计算结果变量sum
int i = 1; //定义循环数字变量i
int flag = 1; //定义符号状态变量flag
//使用for循环
for(i=1;i<=100;i++)
{
sum=sum+(i%2-1)*i+(i%2)*i;
}
printf("sum=%d\n",sum);
return 0;
}
2021-11-24
#include <stdio.h>
int main()
{
int arr[]={0,1,2,3,4,5,6,7,8,9};
int i;
for(i=0;i<=9;i++)
{
printf("%d\n",arr[i]);
}
return 0;
}
int main()
{
int arr[]={0,1,2,3,4,5,6,7,8,9};
int i;
for(i=0;i<=9;i++)
{
printf("%d\n",arr[i]);
}
return 0;
}