摘要: 1.编写一个简单程序,要求数组长度为5,静态赋值10,20,30,40,50,在控制台输出该数组的值 package h; import java.util.Scanner; public class Test2 { public static void main(String[] args) { 阅读全文
posted @ 2023-04-20 23:01 清风饮露ㅤ 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 使用for循环计算1-100的和,除了以3结尾的那些数 package abc; public class Test1 { public static void main(String [] args) { int a=1; int sum=0; for( a=1 ;a<101;a++) { if( 阅读全文
posted @ 2023-04-11 23:00 清风饮露ㅤ 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 1.分别使用for循环,while循环,do循环求1到100之间所有能被3整除的整数的和。(知识点:循环语句) (1)for循环 package com.itheima.practice;public class Test18 { public static void main(String[] a 阅读全文
posted @ 2023-04-05 12:11 清风饮露ㅤ 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 1 输入年份月份,输出该月的天数(闰年2月29天,条件参考上机练习1) package com.itheima.practice;import java.util.Scanner;public class Test9 { public static void main(String[] args) 阅读全文
posted @ 2023-03-29 09:50 清风饮露ㅤ 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 1.定义圆半径,求面积。 package com.itheima.practice;public class Test3 { public static void main(String[] args) { double r=8; double area=3.14*r*r; System.out.p 阅读全文
posted @ 2023-03-21 23:55 清风饮露ㅤ 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序,统计字符串中大写字母的个数。 #include<stdio.h> main(){ char a[10]; int b=0,c=0; gets(a); while(a[b]!='\0') { if(a[b]>='A'&&a[b]<='Z') c++; b++; } printf("%d\ 阅读全文
posted @ 2021-12-09 15:04 清风饮露ㅤ 阅读(20) 评论(0) 推荐(0) 编辑
摘要: 1.#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[i]); } 2. #include<stdio.h> main 阅读全文
posted @ 2021-12-09 14:55 清风饮露ㅤ 阅读(22) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序,使用while语句求和sum=1+3+5+7+…+21。#include<stdio.h>main(){ int a=1,sum=0; while(a<22){ if(a%2<=1) sum+=a; a+=2; } printf("%d\n",sum);} 2.编写程序,使用while 阅读全文
posted @ 2021-12-09 14:43 清风饮露ㅤ 阅读(29) 评论(0) 推荐(0) 编辑
摘要: 编写程序判断n是正数还是负数。 #include<stdio.h> main(){ int n; printf("请输入一个数"); scanf("%d",&n); if(n>0) printf("正数"); else if(n==0) printf("非正非负"); else printf("负数 阅读全文
posted @ 2021-12-09 14:28 清风饮露ㅤ 阅读(26) 评论(0) 推荐(0) 编辑
摘要: 1.三角 #include<stdio.h> main(){ int i,j; for(i=0;i<=5;i++){ for(j=1;j<=1+i;j++){ printf("*"); } printf("\n"); } } #include<stdio.h> main(){ int i,j,k; 阅读全文
posted @ 2021-11-09 10:24 清风饮露ㅤ 阅读(21) 评论(0) 推荐(0) 编辑