#include <stdio.h>
int main()
{
double num = 2.5; //定义浮点型变量num1并赋值为2.5
int mum=(int) mum;
printf("num的整数部分是2\n", num);
return 0;
}
就这样
int main()
{
double num = 2.5; //定义浮点型变量num1并赋值为2.5
int mum=(int) mum;
printf("num的整数部分是2\n", num);
return 0;
}
就这样
2015-01-17
#include <stdio.h>
int main()
{
char c = 'a';
int n; //将c赋值给n
float f; //将c赋值给f
double d; //将c赋值给d
n=c;
f=n;
d=f;
printf("%d\n",n);
printf("%f\n",f);
printf("%lf\n",d);
return 0;
}
就过了
int main()
{
char c = 'a';
int n; //将c赋值给n
float f; //将c赋值给f
double d; //将c赋值给d
n=c;
f=n;
d=f;
printf("%d\n",n);
printf("%f\n",f);
printf("%lf\n",d);
return 0;
}
就过了
2015-01-17
#include <stdio.h>
int main() {
int year = 2014;
if(year % 4 == 0 && year % 100 !=0 || year % 400 == 0 )
{
puts("今年是闰年");
}
else
{
puts("今年是平年");
}
//我讨厌那些多余的东西,这种算式很复杂
}
int main() {
int year = 2014;
if(year % 4 == 0 && year % 100 !=0 || year % 400 == 0 )
{
puts("今年是闰年");
}
else
{
puts("今年是平年");
}
//我讨厌那些多余的东西,这种算式很复杂
}
2015-01-17
#include<stdio.h>
int main(){
int height = 185;
if(height >= 180)
{
printf("%s\n\n""恭喜小明可以参加校篮球队");
}
}
int main(){
int height = 185;
if(height >= 180)
{
printf("%s\n\n""恭喜小明可以参加校篮球队");
}
}
2015-01-17
#include <stdio.h>
int main()
{
int age = 18;
float height = 1.85;
char unit = 'm';
printf("小明今年%d岁\n", age);
printf("小明身高%.2f%c\n", height, unit);
printf("%s","小明现在在慕课网上学习IT技术");
return 0;
}
int main()
{
int age = 18;
float height = 1.85;
char unit = 'm';
printf("小明今年%d岁\n", age);
printf("小明身高%.2f%c\n", height, unit);
printf("%s","小明现在在慕课网上学习IT技术");
return 0;
}
2015-01-17