`
sexafei
  • 浏览: 6901 次
  • 性别: Icon_minigender_1
  • 来自: 重庆
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论
文章列表
求质数   package com.baidu.zhidao;   public class PrimeNumbers {   private static int count = 0; public static void main(String[] args) { for (int i = 101; i < 200; i++) { boolean flag = true; double num = Math.sqrt(i); for(int j = 2;j<num;j++){ if(i%j==0){ fl ...
求一个数的质因素   package com.baidu.zhidao;   import java.util.Scanner;   public class PrimeFactor {   private static int k = 2;   public static void main(String[] args) { while (true) { try { System.out.print("Type in a number(0 to Exit): "); Scanner scanner = new ...
判断是否是回文数或字符串   package com.baidu.zhidao;   import java.util.Scanner;   public class Palindrom {   public static void main(String[] args) { while (true) { try { System.out.print("Waiting for type in:"); boolean flag = true; Scanner s = new Scanner(System.in) ...
输入一个数,判断位数并倒序输出   package com.baidu.zhidao;   import java.util.Scanner;   public class InvertedOrder {   public static void main(String[] args) { while (true) { try { System.out.print("Type in a number:"); String str = ""; Scanner s = new Scanne ...
求水仙花数。     package com.baidu.zhidao;   public class NarcissusNumber {   public static void main(String[] args) { int n,nn,nnn; for(int i = 100;i<1000;i++){ n = i%10; nn = (i/10)%10; nnn = i/100; if(i == n*n*n+nn*nn*nn+nnn*nnn*nnn){ System.out.print("Narci ...
可统计你录入的数字,字母,空格,符号。   package com.baidu.zhidao;   import java.util.Scanner;   public class CharacterStatistics {   public static void main(String[] args) { while (true) { try { int numberCount = 0,charCount = 0,spaceCount = 0,otherCount = 0; System.out.println("Wai ...
杨辉三角   不带空格格式化的:     package com.baidu.zhidao; public class Test { public static void main(String[] args) { final int Row = 6; int yh[][] = new int[Row][Row]; for (int i = 0; i < Row; i++) { yh[i][0] = 1; yh[i][i] = 1; } for (int i = 2; i < Row; i++) { for ( ...
package com.baidu.zhidao; import java.util.Scanner; public class GCD_and_LCM { private static int max, min, temp; public static void main(String[] args) { while (true) { try { int a, b, gcd, lcm; System.out.println("Pleasy type in two number! Type in 0 to e ...
Global site tag (gtag.js) - Google Analytics