package com.wsy.work;
public class JudgeNumber {
public static void main(String[] args) {
int a = 5;
if(a % 2 == 0)
{
System.out.println(a+"是偶数");
}
else
{
System.out.println(a+"是奇数");
}
}
}
package com.wsy.work;
import java.math.BigDecimal;
import java.util.Scanner;
public class Circle {
public static void main(String[] args) {
BigDecimal PI = new BigDecimal("3.14");
Scanner in = new Scanner(System.in);
System.out.print("请输入圆的半径:");
BigDecimal ridius = new BigDecimal(in.nextLine());
BigDecimal s = ridius.multiply(ridius).multiply(PI);
System.out.println("圆的面积为:"+s);
in.close();
}
}
package com.wsy.work;
import java.util.Scanner;
public class EncryptionDevice {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int number = Integer.parseInt(in.nextLine());
double result = (number*10+5)/2+3.14159;
System.out.println("加密结果为:"+result);
}
}
package com.wsy.work;
public class Work4 {
public static void main(String[] args) {
final int CHICKEN = 100;
final int MONEY = 100;
for(int i = 0; i<=20; i++)
{
for(int j = 0; j<=33; j++)
{
for(int k = 0; k<=300; k=k+3)
{
if(i*5+j*3+k/3 == MONEY && i+j+k == CHICKEN)
{
System.out.println("公鸡:"+i);
System.out.println("母鸡:"+j);
System.out.println("公鸡:"+k);
System.out.println("=================================================="); }
}
}
}
}
}
package com.wsy.work;
public class Work5 {
public static void main(String[] args) {
int number;
int count = 0;
for(int i = 1; i<=4; i++)
{
for(int j =1; j<=4; j++)
{
for(int k = 1; k<=4; k++)
{
if(i != j && i != k && j!=k)
{
count++;
number = i*100+j*10+k;
System.out.println(number);
}
}
}
}
System.out.println("======================================================");
System.out.println("不重复的数字总共有:"+count+"个");
}
}
package com.wsy.work;
import java.util.Scanner;
public class IsPrime {
public static void main(String[] args) {
boolean isPrime = true;
Scanner in = new Scanner(System.in);
int number = Integer.parseInt(in.nextLine());
if(number == 1)
{
isPrime = false ;
}
for(int i = 2; i<=Math.sqrt(number); i++)
{
if(number % i ==0)
{ isPrime = false ;
break;
}
}
if(isPrime)
{
System.out.println(number+"是素数");
}
else
{
System.out.println(number+"不是素数");
}
in.close();
}