#include <stdio.h>
int main()
{
int year = 2014; //今年是2014年
//补全一下代码
if( ((0 ==year%4)&&(0 !=year%100))||(0 == year %400))
{
printf("%s\n","今年是闰年");
}
else
{
printf("%s\n","今年是平年");
}
return 0;
}
int main()
{
int year = 2014; //今年是2014年
//补全一下代码
if( ((0 ==year%4)&&(0 !=year%100))||(0 == year %400))
{
printf("%s\n","今年是闰年");
}
else
{
printf("%s\n","今年是平年");
}
return 0;
}
2022-05-08
while循环
#include <stdio.h>
int main()
{
int sum = 0;
//定义计算结果变量sum
int i = 1;
//定义循环数字变量i
int flag = 1;
//定义符号状态变量flag
//使用while循环
while(i<=100)
{
sum+=i*flag;
flag=-flag;
i++;
}
printf("%d",sum);
return 0;
}
#include <stdio.h>
int main()
{
int sum = 0;
//定义计算结果变量sum
int i = 1;
//定义循环数字变量i
int flag = 1;
//定义符号状态变量flag
//使用while循环
while(i<=100)
{
sum+=i*flag;
flag=-flag;
i++;
}
printf("%d",sum);
return 0;
}
2022-04-23
#include<stdio.h>
int main()
{
int i;
int sum=0;
for(i=1; i<11; i++)
{
sum+=i;
}
printf("%d",sum);
return 0;
}
int main()
{
int i;
int sum=0;
for(i=1; i<11; i++)
{
sum+=i;
}
printf("%d",sum);
return 0;
}
2022-04-23
#include <stdio.h>
int main()
{
int height = 185;
//补全所有代码
if(height>=180){
printf("%s\n","恭喜小明可以参加校篮球队");
}
return 0;
}
int main()
{
int height = 185;
//补全所有代码
if(height>=180){
printf("%s\n","恭喜小明可以参加校篮球队");
}
return 0;
}
2022-04-11
#include <stdio.h>
int main()
{
int sum = 0;
int i;
for(i=1; i<=10; i++)
{
printf("%d\n", i);
if(i==3){
goto loop;
}
}
loop:printf("结束for循环了...."); //请选择合适位置添加标识符
return 0;
}
int main()
{
int sum = 0;
int i;
for(i=1; i<=10; i++)
{
printf("%d\n", i);
if(i==3){
goto loop;
}
}
loop:printf("结束for循环了...."); //请选择合适位置添加标识符
return 0;
}
2022-04-09
#include <stdio.h>
int main(){
int age = 18;
float height = 1.85;
char unit = 'm';
printf("小明今年18岁%d,\n", age);
printf("小明身高1.850000m%f,%c,\n", height, unit);
printf("小明现在在慕课网上学习IT技术%s,\n");
return 0;
}
int main(){
int age = 18;
float height = 1.85;
char unit = 'm';
printf("小明今年18岁%d,\n", age);
printf("小明身高1.850000m%f,%c,\n", height, unit);
printf("小明现在在慕课网上学习IT技术%s,\n");
return 0;
}
2022-04-05