赞
踩
public class SY11{
public static void main(String args[]){
char x,y,z;
x='W';
y='\\';
z='\116';
System.out.print(x);
System.out.print(y);
System.out.print(z);
}
}
运行结果: W\N
public class SY12{
public static void main(String args[]){
boolean x,y,z;
int a=6,b=24;
x=(a<b);
y=(a==b);
z=(a+b!=26);
System.out.println("x="+x);
System.out.println("y="+y);
System.out.println("z="+z);
}
}
运行结果:
x=true
y=false
z=true
public class SY13{
public static void main(String args[]){
int x,y,z=0;
for (x=1;x<=10;x++)
for (y=1;y<10;y++){
if (x==5) continue;
if (y>5) break;
z++;
}
System.out.println("z="+z);
}
}
运行结果: z=45
import java.util.Scanner;
public class Fudianshu {
public static void main(String[] args) {
Scanner sc =new Scanner(System.in);
double x = sc.nextDouble();
double y = sc.nextDouble();
System.out.println("x+y="+(x+y));
System.out.println("x-y="+(x-y));
System.out.println("x*y="+(x*y));
System.out.println("x/y="+(x/y));
}
}
package javaTest;
public class Qiangzhi {
public static void main(String[] args) {
double n =3.1415926;
System.out.println((int)n);
}
}
import java.util.Scanner; public class Shentizhiliang { public static void main(String[] args) { Scanner sc =new Scanner(System.in); System.out.println("请输入该人的体重(kg)和身高(m)"); double T = sc.nextDouble(); double H = sc.nextDouble(); double BMI = T/(H*H); if(BMI <=18.4) { System.out.println("偏瘦"); } else if(BMI >18.4 && BMI <=23.9) { System.out.println("正常"); } else if(BMI >23.9 && BMI <=27.9) { System.out.println("过重"); } else if(BMI >28.0) { System.out.println("肥胖"); } } }
public class Dayin {
public static void main(String[] args){
for(int i=0;i<6;i++){
for(int j=5-i;j>0;j--){
System.out.print(" ");
}
for(int k=0;k<=2*i;k++){
System.out.print("*");
}
System.out.println();
}
}
}
public class Sushu { public static void main(String[] args) { int sum = 0;//十个素数的累加和 int I=0;//统计找到多少个素数 for(int n=1000;n>=3;n--) {//从1000开始往小找就能找最大的 int yn=1;//yn为1时经过下面循环后如果没有变成0 说明它是素数 for(int i=2; i<n; i++) { if(n % i==0) {//发现能被小的数整除不是素数终止小循环 yn=0; break; } } if(yn==1) { System.out.print(n+" "); sum = sum + n; I++; if(I==10) {//如果已经找够十个终止大循环 break; } } } System.out.println("累加和为: sum = "+sum); } }
public class Shuixianhua {
public static void main(String[] args) {
for(int n=100;n<1000;n++)
{
//提取个十百位
int ge = n%10;
int shi = n%100/10;
int bai = n/100;
if(n==(ge*ge*ge)+(shi*shi*shi)+(bai*bai*bai)) {
System.out.println(n);
}
}
}
}
import java.util.Scanner; public class Fmax { public static void main(String[] args) { Scanner sc =new Scanner(System.in); int a = sc.nextInt(); int count = 0; int max = a; while(a != 0) { if(a>max) { max=a; } else if(a==max) { count++; } a = sc.nextInt(); } System.out.println("最大数是:"+max+"出现的次数:"+count); } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。