摘要: 1.定义圆形半径,求面积 package yyyy; public class Wy { public static void main(String[] args) { // TODO Auto-generated method stub int r=2; double area; area=3. 阅读全文
posted @ 2023-03-21 14:40 王师蕴 阅读(12) 评论(0) 推荐(0) 编辑
摘要: 1.输入一个三位数,求个位,十位,百位 #include<stdio.h> main() { int a=857; int ge=a%10; int shi=a/10%10; int bai=a/100; printf("个位是%d,十位是%d,百位是%d",ge,shi,bai); } 2.输入一 阅读全文
posted @ 2021-12-04 21:05 王师蕴 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 1.实现一个菜单 可以切换 ,可以返回主菜单 主菜单 1.登录 2.注册 3.输出水仙花 4.退出程序 请选择: #include<stdio.h> int cz; int passwd,canumber; caidan(){ printf("*************主菜单************ 阅读全文
posted @ 2021-12-04 21:00 王师蕴 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序,统计字符串中大写字母的个数 #include<stdio.h> main() { char str[5]; int i,cnt; cnt=i=0; gets(str); while(str[i]!='\0') {if(str[i]>='A'&&str[i]<='Z') cnt++; i 阅读全文
posted @ 2021-11-23 09:59 王师蕴 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 1.定义一个含有8个存储单元的实型数组,从键盘上接收数,然后逆序输出 #include<stdio.h> main(){ double a[8]; int i; for(i=0;i<=7;i++); scanf("%lf",&a[i]); for(i=7;i>=0;i--); printf("%f" 阅读全文
posted @ 2021-11-23 09:22 王师蕴 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 1. 猜数字:随机产生一个0-99的数,猜猜看如果大了就提示大了点如果小了就提示小了点直到猜对为止 #include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int a,n; srand((unsigned)time( 阅读全文
posted @ 2021-11-23 09:19 王师蕴 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 1.输出图形 #include <stdio.h> main() { int i,j; for(i=1;i<=5;i++) { for(j=1;j<=i;j++) { printf("*"); } printf("\n"); } } 2..输出图形 #include <stdio.h> main() 阅读全文
posted @ 2021-11-23 09:18 王师蕴 阅读(3) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序,使用while语句求和sum=1+3+5+…+21 #include<stdio.h> main() { int i=1,sum=0; while(i<=21){ sum+=i; i+=2; } printf("Sum=%d\n",sum); } 2.编写程序,使用while语句求和s 阅读全文
posted @ 2021-11-07 21:36 王师蕴 阅读(12) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序,使用if的多分支结构,将输入的分数mark(0~100整数)转换为相应的等级(90~100为A,80~89为B,70~79为C,60~69为D,0~59为NO PASS!) #include<stdio.h> main() { int mark; printf("输入学生的分数(0-1 阅读全文
posted @ 2021-10-30 21:53 王师蕴 阅读(25) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序判断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-30 21:39 王师蕴 阅读(26) 评论(0) 推荐(0) 编辑