选择语句

int main()

{  

int coding = 0;

printf("你会敲代码吗?(选择1 or 0):>");

scanf_s("%d",&coding);

if (coding == 1)

{

 printf("坚持,你会有好工作\n");

}

else

{

 printf("放弃,回家卖红薯\n");

}

return 0;

}

循环语句

int main()

{

int line = 0;

printf("加入比特\n");

while (line<2000)

{

 printf("敲一行代码:%d\n",line);

 printf("我要继续努力敲代码\n");

 line++;

}

if (line >= 2000)

 printf("赢取白富美\n");

return 0;

}

函数 简化代码,代码复用

int Add(int x, int y)

{
int z = x + y;
return z;
}
int main()
{
int num1 = 0;
int num2 = 0;
int sum = 0;
printf("%d %d", &num1, &num2);
sum = Add(num1, num2);
printf("sum = %d\n", sum);
return 0;
}