#include <stdio.h>
int main()
{
int year = 2014; //今年是2014年
//补全一下代码
if((year%4==0&&year%100!=0)||year%400==0)
{
printf("%s\n","今年是闰年");
}
else
{
printf("%s\n","今年是平年");
}
return 0;
}
int main()
{
int year = 2014; //今年是2014年
//补全一下代码
if((year%4==0&&year%100!=0)||year%400==0)
{
printf("%s\n","今年是闰年");
}
else
{
printf("%s\n","今年是平年");
}
return 0;
}
2015-01-18
#include <stdio.h>
int main()
{
int year = 2014; //今年是2014年
//补全一下代码
if(year%4==0 && year%100!=0 || year%400== 0)
{
printf("%s\n","今年是闰年");
}
else
{
printf("%s\n","今年是平年");
}
return 0;
int main()
{
int year = 2014; //今年是2014年
//补全一下代码
if(year%4==0 && year%100!=0 || year%400== 0)
{
printf("%s\n","今年是闰年");
}
else
{
printf("%s\n","今年是平年");
}
return 0;
2015-01-18
#include <stdio.h>
int main() {
double number = 200;
int year = 2014;
do
{
year++;
number*=1.2 ;
}
while(number<1000);
printf("到%d年招工规模突破1000人\n", year);
}
int main() {
double number = 200;
int year = 2014;
do
{
year++;
number*=1.2 ;
}
while(number<1000);
printf("到%d年招工规模突破1000人\n", year);
}
2015-01-18
#include <stdio.h>
int main() {
int sale = 120;
int year = 1;
if (sale > 100)
{
if (year >= 2)
{
puts("恭喜你,获得优秀员工奖\n");
}
else
{
puts("很遗憾,期望你再接再厉\n");
}
}
}
int main() {
int sale = 120;
int year = 1;
if (sale > 100)
{
if (year >= 2)
{
puts("恭喜你,获得优秀员工奖\n");
}
else
{
puts("很遗憾,期望你再接再厉\n");
}
}
}
2015-01-18
除法运算符“/”。二元运算符,具有左结合性。参与运算的量均为整型时,结果为整型,舍去小数。如果运算量中有一个为实型,结果为双精度实型。c/d除法得到的是商,c%d除法得到的是余数,两者都是整型
2015-01-18
#include <stdio.h>
int main()
{
double num1 = 2.5; //定义浮点型变量num1并赋值为2.5
int num=(int)num1;
printf("num的整数部分是%d\n", num);
return 0;
}
int main()
{
double num1 = 2.5; //定义浮点型变量num1并赋值为2.5
int num=(int)num1;
printf("num的整数部分是%d\n", num);
return 0;
}
2015-01-18
char c;
int n;
float f;
double d;
c='a';
n =c ; //将c赋值给n
f =c; //将c赋值给f
d = c; //将c赋值给d
printf("%d\n",n);
printf("%f\n",f);
printf("%lf\n",d);
return 0;
int n;
float f;
double d;
c='a';
n =c ; //将c赋值给n
f =c; //将c赋值给f
d = c; //将c赋值给d
printf("%d\n",n);
printf("%f\n",f);
printf("%lf\n",d);
return 0;
2015-01-18