摘要: #include<stdio.h> main(){ int a; scanf("%d",&a); if(a>0) printf("正数\n"); else if(a==0) printf("0\n"); else printf("负数\n"); } #include<stdio.h> main(){ 阅读全文
posted @ 2021-11-27 22:02 L-Ynan 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 1、编写程序,定义两个整形变量,赋值并输出。 #include<stdio.h> main() { int a=1,b=2; printf("%d\n%d\n",a,b); } 2、编写程序,定义一个单精度和一个双精度的变量,赋值并输出。 #include<stdio.h> main() { flo 阅读全文
posted @ 2021-11-27 22:01 L-Ynan 阅读(33) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h> #include<string.h> void denglu(); void zhuce(); void shuixianhua(); main() { int a; printf("请选择\n1.登录\n2.注册\n3.输出水仙花数\n4.退出程序\n"); s 阅读全文
posted @ 2021-11-27 21:58 L-Ynan 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 1 统计字符串中各数字的长度 #include<stdio.h> main(){ char a[50]; int i; gets(a); for(i=0;a[i]!='\0';i++) ; printf("%d",i); } 2 编写程序,统计字符串中大写字母的个数 #include<stdio.h 阅读全文
posted @ 2021-11-23 09:39 L-Ynan 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 1 定义一个含有8个存储单元的实型数组,从键盘上接收数,然后逆序输出。 #include<stdio.h> main(){ double m[8]; int i; for(i=0;i<=7;i++) scanf("%lf",&m[i]); for(i=7;i>=0;i--) printf("%f", 阅读全文
posted @ 2021-11-16 11:00 L-Ynan 阅读(23) 评论(0) 推荐(0) 编辑
摘要: 猜数字: 随机产生一个0-99的数,猜猜看 如果大了 就提示大了点 如果小了 就提示小了点 直到猜对为止 #include <stdio.h> #include <stdlib.h> #include <time.h> main(){ int x,guess; srand((unsigned int 阅读全文
posted @ 2021-11-15 19:07 L-Ynan 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序,使用while语句求和和sum=1+3+5+...+21。 #include <stdio.h> main(){ int i=1; int sum=0; while(i<=21) { sum+=i; i+=2; } printf("Sum=%d\n",sum); } 2.编写程序,使用 阅读全文
posted @ 2021-11-02 16:40 L-Ynan 阅读(24) 评论(0) 推荐(0) 编辑
摘要: .编写程序判断n是正数还是负数。 #include<stdio.h> main() { int n; printf("请输入一个整数:\n"); scanf("%d",&n); if(n>0) printf("%d是正数!\n",n); else if(n==0) printf("%d既不是正数,也 阅读全文
posted @ 2021-10-31 09:52 L-Ynan 阅读(17) 评论(0) 推荐(0) 编辑
摘要: 1,编写程序,判断一个数n是正数还是负数 #include<stdio.h> main(){ float n; scanf("%f",&n); if(n>0) printf("正数!\n"); else if(n==0) printf("0既不是正数,也不是负数!\n"); else printf( 阅读全文
posted @ 2021-10-19 20:36 L-Ynan 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 1. 编写程序,使用scanf()函数接收整型,实型,字符型的变量,并分行依次输出。 2. #include<stdio.h> 3. main() 4. { 5. int a; 6. float b; 7. char c; 8. scanf("%d,%f,%c",&a,&b,&c); 9. prin 阅读全文
posted @ 2021-10-17 16:22 L-Ynan 阅读(29) 评论(0) 推荐(0) 编辑