王雪奇

博客园 首页 新随笔 联系 订阅 管理

2023年7月5日 #

摘要: 1.1定义圆的半径,求面积。package wang; import java.util.Scanner; public class wang { public static void main(String[] args) { // TODO Auto-generated method stub 阅读全文
posted @ 2023-07-05 19:13 雪.?! 阅读(3) 评论(0) 推荐(0) 编辑

2021年12月8日 #

摘要: 1.实现一个菜单. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 阅读全文
posted @ 2021-12-08 21:43 雪.?! 阅读(5) 评论(0) 推荐(0) 编辑

摘要: 1编写程序,使用循环结构,计算字符串长度。 #include<stdio.h> main(){ char a[50]; int i; gets(a); for(i=0;a[i]!='\0';i++); printf("%d",i); } 1 2 3 4 5 6 7 8 9 10 11 12 13 1 阅读全文
posted @ 2021-12-08 21:40 雪.?! 阅读(18) 评论(0) 推荐(0) 编辑

摘要: 1.编写程序,统计字符串中大写字母的个数。 #include <stdio.h> main(){ char str[20]; int i,cnt; cnt=i=0; gets(str); while(str[i]!='\0'){ if(str[i]>='A'&&str[i]<='Z'){ cnt++ 阅读全文
posted @ 2021-12-08 21:38 雪.?! 阅读(25) 评论(0) 推荐(0) 编辑

摘要: 1. 猜数字:随机产生一个0-99的数,猜猜看如果大了就提示大了点如果小了就提示小了点直到猜对为止 #include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int a,n; srand((unsigned)time( 阅读全文
posted @ 2021-12-08 21:36 雪.?! 阅读(20) 评论(0) 推荐(0) 编辑

摘要: 定义一个含有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",m[ 阅读全文
posted @ 2021-12-08 21:35 雪.?! 阅读(37) 评论(0) 推荐(0) 编辑

摘要: 1,使用while语句求和sum=1+3+5+……+21. #include <stdio.h> main() { int num=0,i=1; while(i<=21) { num+=i; i+=2; } printf("结果是%d",num); } 2.使用while语句求和sum=1+1/3+ 阅读全文
posted @ 2021-12-08 21:32 雪.?! 阅读(17) 评论(0) 推荐(0) 编辑

摘要: 1.编写程序判断n是正数还是负数。 #include<stdio.h> main(){ float n; printf("输入一个数\n"); scanf("%f",&n); if(n>0) printf("%f是正数"); else if(n==0) printf("%f既不是正数也不是负数"); 阅读全文
posted @ 2021-12-08 21:29 雪.?! 阅读(21) 评论(0) 推荐(0) 编辑

摘要: 1,编写程序,使用scanf()函数接收整型,实型,字符型的变量,并分行依次输出。 main() { int a;#include<stdio.h> float b; char c; scanf("%d%f%c",&a,&b,&c); printf("%d\n%f\n%c\n",a,b,c); } 阅读全文
posted @ 2021-12-08 21:26 雪.?! 阅读(36) 评论(0) 推荐(0) 编辑

2021年11月7日 #

摘要: 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-11-07 21:16 雪.?! 阅读(12) 评论(0) 推荐(0) 编辑