Java program to check whether a given number is ugly number or notimport java.util.Scanner; public class CheckUglyNumbers { public static void main(String[] args) { // create object of scanner class. Scanner Sc = new Scanner(System.in); // enter the positive number System.out.print("...
RUN 1: Enter Number: 153 Number is armstrong RUN 2: Enter Number: 123 Number is not armstrong Explanation:In the above program, we declare the package main. The main package is used to tell the Go language compiler that the package must be compiled and produced the executable file. Here,...
And, here is the complete Java program to check if a given number is prime or not. This question is also asked on written tests and interviews as tohow to print prime numbers from 1 to 100or finding the prime factor of a number in Java. And, there is another exercise for you to do...
I will put my solutions toLeetcode Problemsin this repo. Every problem will be solved in C++; part of the problems will be solved in Java also. I will try my best to support more language in the future :) Please feel free to contact me if you have any questions with this repo:) e...
0230-Kth-Smallest-Element-in-a-BST/cpp-0230 0232-Implement-Queue-using-Stacks/cpp-0232 0232-Implement-Queue-using-Stacks/cpp-0232 0233-Number-of-Digit-One/cpp-0233 0233-Number-of-Digit-One/cpp-0233 0234-Palindrome-Linked-List/cpp-0234 0234-Palindrome-Linked-List/cpp-0234 0235-Lowest-Common-...
Java program to check whether given number is Kaprekar number or not publicclassKaprekarNumbers{publicstaticvoidmain(String[]args){intctr=0;intbase=(args.length>0)?Integer.parseInt(args[0]):10;for(longn=1;n<=1000;n++){StringSt=Long.toString(n*n,base);for(intj=0;j<St.length()/2+1...
In the above code, we read an integer number from the user and then print the table of the given number using the Do Loop While loop on the console screen.VB.Net Basic Programs »VB.Net program to check the given number is Armstrong or not using the While loop VB.Net program to ...
0414-Third-Maximum-Number/cpp-0414 0416-Partition-Equal-Subset-Sum 0416-Partition-Equal-Subset-Sum 0417-Pacific-Atlantic-Water-Flow/java-0417/src 0417-Pacific-Atlantic-Water-Flow/java-0417/src 0423-Reconstruct-Original-Digits-from-English/cpp-0423 0423-Reconstruct-Original-Digits-from-English/cpp-042...
167 Two Sum II - Input array is sorted solution C++ Java 169 Majority Element solution C++ Python 170 Two Sum III - Data structure design [无] C++ 171 Excel Sheet Column Number [无] C++ 173 Binary Search Tree Iterator [无][缺:Morris遍历] C++ 186 Reverse Words in a String II [...
Program to generate and print random number in Javaimport java.util.Scanner; public class GenerateRandomIntegers { public static void main( String args[] ) { // create object here. Scanner sc = new Scanner( System.in ); // enter the range between which we have to print random numbers. ...