2021年7月28日
摘要: 1 //数字交换 2 #include<stdio.h> 3 int main() 4 { 5 int first ; 6 int second; 7 int third; 8 //交换前的数字 9 printf("\n请输入第一个数字:"); 10 scanf("%d",&first); 11 1 阅读全文
posted @ 2021-07-28 12:20 Bytezero! 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 注意:前置 ++ 要先算 后置++ 最后程序运行完 然后再++1 #include <stdio.h> 2 int main() 3 { 4 int num = 10; 5 int result = --num < 20 && num++ >=9; 6 printf("result = %d\tnu 阅读全文
posted @ 2021-07-28 12:18 Bytezero! 阅读(60) 评论(0) 推荐(0) 编辑
摘要: /*此例子只做比喻演示*/ 1 #include <stdio.h> 2 int main() 3 { 4 5 int p; 6 scanf("%d",&p); 7 if(p > 9999) 8 { 9 printf("走吧去结婚"); 10 } 11 else if (p>1000 && p<=9 阅读全文
posted @ 2021-07-28 12:16 Bytezero! 阅读(326) 评论(0) 推荐(0) 编辑
摘要: 1 /*此例子只作为演示*/ 2 3 #include <stdio.h> 4 int main() 5 { 6 printf("请问贵公司给出的薪资是:\n"); 7 8 double c ; 9 10 //printf("我们给出的是:"); 11 scanf("%lf",&c); 12 13 阅读全文
posted @ 2021-07-28 12:14 Bytezero! 阅读(324) 评论(0) 推荐(0) 编辑
摘要: //100的累加和 while 循环 #include <stdio.h> int main() { int sum = 0; //5050 int i = 0; while(i < 101) { sum = sum +i; i++; } printf("%d\n",sum); } 阅读全文
posted @ 2021-07-28 12:12 Bytezero! 阅读(161) 评论(0) 推荐(0) 编辑
摘要: while 只要给定的条件为真,C 语言中的 while 循环语句会重复执行一个目标语句 一般定义 //return_type function_name( parameter list ) //{ // body of the function //} 在 C 语言中,函数由一个函数头和一个函数主 阅读全文
posted @ 2021-07-28 12:12 Bytezero! 阅读(297) 评论(0) 推荐(0) 编辑
摘要: 1 int main() 2 { 3 int sum ; 4 int i; 5 for(i = 0; i<101; i++) 6 { 7 sum += i; 8 } 9 printf("100的累加和为:%d",sum); //5050 10 } 阅读全文
posted @ 2021-07-28 12:10 Bytezero! 阅读(287) 评论(0) 推荐(0) 编辑
摘要: 1 #include <stdio.h> 2 int main() 3 { 4 5 int num = 123456; 6 while(num>0) 7 { 8 9 10 printf("%d\n",num % 10); 11 num=num/10; //去掉取掉的最后一位 12 } 阅读全文
posted @ 2021-07-28 12:09 Bytezero! 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 1 #include <stdio.h> 2 int main () 3 { 4 double salary ; //工资 5 double total_salary = 0; 6 double adv_salary; 7 int i ; 8 for(i = 0;i < 6;i++) 9 { 10 阅读全文
posted @ 2021-07-28 12:07 Bytezero! 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 1 //输入一个数字,找出整数相加都等于输入的数字 2 3 4 #include <stdio.h> 5 int main() 6 { 7 int num ; 8 int i ; 9 printf("请输入一个数字: "); //6 10 scanf("%d",&num); 11 12 for( i 阅读全文
posted @ 2021-07-28 12:04 Bytezero! 阅读(79) 评论(0) 推荐(0) 编辑