随笔分类 -  java

摘要://find number of times each digit occur in a number import java.util.Scanner; public class Numbers { public static void main(String[] args) { int num; int[] arr = new int[10]; // we use hashing to sol 阅读全文
posted @ 2020-01-03 09:44 anobscureretreat 阅读(1884) 评论(0) 推荐(0) 编辑
摘要://check whether the number is palindrome or not /* * a number is said to be palindrome if, reverse of the number is same to * that of real. for example, 121, 52025, 5885 etc.. */ import java.u... 阅读全文
posted @ 2020-01-03 09:42 anobscureretreat 阅读(688) 评论(0) 推荐(0) 编辑
摘要://print all digits of the given number import java.util.Scanner; public class Numbers { public static void main(String[] args) { int num; Scanner ip = new Scanner(System.in);... 阅读全文
posted @ 2019-12-27 14:19 anobscureretreat 阅读(356) 评论(0) 推荐(0) 编辑
摘要://print all prime numbers within a number import java.util.Scanner; public class Numbers { public static void main(String[] args) { int beg, end; Scanner ip = new Scanner(System.in); System.out.print( 阅读全文
posted @ 2019-12-27 14:18 anobscureretreat 阅读(867) 评论(0) 推荐(0) 编辑
摘要://find n'th prime number import java.util.Scanner; public class Numbers { public static void main(String[] args) { int n, count = 0, i = 2; Scanner ip = new Scanner(System.in); System.out.print("Enter 阅读全文
posted @ 2019-12-27 14:16 anobscureretreat 阅读(749) 评论(0) 推荐(0) 编辑
摘要://Generate n prime numbers import java.util.Scanner; public class Numbers { public static void main(String[] args) { int n, count = 0; Scanner ip = new Scanner(System.in); System.out.print("Enter the 阅读全文
posted @ 2019-12-27 14:14 anobscureretreat 阅读(532) 评论(0) 推荐(0) 编辑
摘要://check prime, find whether the input number is prime number or not import java.util.Scanner; public class Numbers { public static void main(String[] args) { int num; boolean... 阅读全文
posted @ 2019-12-25 20:40 anobscureretreat 阅读(5217) 评论(0) 推荐(0) 编辑
摘要://find nd smallest among n numbers import java.util.Scanner; public class Numbers { public static void main(String[] args) { int n, temp, min = Integer.MAX_VALUE, secondMin = Integer.MAX_VALUE; Scanne 阅读全文
posted @ 2019-12-25 20:33 anobscureretreat 阅读(650) 评论(0) 推荐(0) 编辑
摘要://find nd greatest among n numbers import java.util.Scanner; public class Numbers { public static void main(String[] args) { int n, temp, max = Integer.MIN_VALUE, secondMax = Integer... 阅读全文
posted @ 2019-12-25 20:27 anobscureretreat 阅读(691) 评论(0) 推荐(0) 编辑
摘要://pre increment public class Sample { public static void main(String[] args) {int a, b, c, d, e; Scanner s = new Scanner(System.in); System.out.print("Enter any integer a:"); ... 阅读全文
posted @ 2019-12-25 20:25 anobscureretreat 阅读(345) 评论(0) 推荐(0) 编辑
摘要://find greatest among n numbers import java.util.Scanner; public class Numbers { public static void main(String[] args) { int n, temp, max = Integer.MIN_VALUE; Scanner ip = new Scanner(System.in); Sys 阅读全文
posted @ 2019-12-25 20:21 anobscureretreat 阅读(1104) 评论(0) 推荐(0) 编辑
摘要:2 求三个数中最小值 3 阅读全文
posted @ 2019-12-25 20:16 anobscureretreat 阅读(3422) 评论(0) 推荐(0) 编辑
摘要://find greatest among two numbers import java.util.Scanner; public class Numbers { public static void main(String[] args) { int num1, num2; Scanner ip = new Scanner(System.in); System.out.print("Enter 阅读全文
posted @ 2019-12-25 12:23 anobscureretreat 阅读(4112) 评论(1) 推荐(0) 编辑
摘要:2 阅读全文
posted @ 2019-12-25 12:18 anobscureretreat 阅读(3225) 评论(0) 推荐(0) 编辑
摘要://switch statement import java.util.Scanner; public class Sample { public static void main(String[] args) { int num; Scanner ip = new Scanner(System.in); System.out.print("Enter number between 1 to 4: 阅读全文
posted @ 2019-12-25 12:15 anobscureretreat 阅读(571) 评论(0) 推荐(0) 编辑
摘要:2 3 4 阅读全文
posted @ 2019-12-21 09:42 anobscureretreat 阅读(137) 评论(0) 推荐(0) 编辑
摘要:demo2 demo3 阅读全文
posted @ 2019-12-19 09:59 anobscureretreat 阅读(288) 评论(0) 推荐(0) 编辑
摘要:获取多个整数输入 获取字符串 获取多个字符串 阅读全文
posted @ 2019-12-19 09:53 anobscureretreat 阅读(3063) 评论(0) 推荐(0) 编辑
摘要:public class Sample { public static void main(String[] args) { int num = 10; do { System.out.print(num + " "); } while (num != 10); } } OUTPUT: 10 阅读全文
posted @ 2019-12-19 09:52 anobscureretreat 阅读(618) 评论(0) 推荐(0) 编辑
摘要:public class Sample { public static void main(String[] args) { int num = 1; while (num <= 10) { System.out.print(num + " "); num++; } } } OUTPUT: 1 2 3 4 5 6 7 8 9 10 阅读全文
posted @ 2019-12-19 09:48 anobscureretreat 阅读(238) 评论(0) 推荐(0) 编辑