77 results found for ""

Codes (67)
• Product of digits of a two digit number in Java | AskTheCode

How to find product of digits of a two digit number in Java | AskTheCode import java.util.Scanner; class productOfDigitsOfNumber{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter a two digit number: "); int n = sc.nextInt(); int product = 1; product = n % 10; n = n - product; n = n / 10; product *= n; System.out.println("The product is: "+product); } }

• Print digits of a number separately in Java | AskTheCode

How to print the digits of a number separately in java | AskTheCode import java.util.Scanner; class printNumberSeparately{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter the number: "); int n = sc.nextInt(); int tmp = n, factor = 1; while(tmp != 0){ tmp = tmp / 10; factor = factor * 10; } while(factor > 1){ factor = factor / 10; System.out.print((n/factor)+" "); n = n % factor; } } }

• #Problem Solving2 in Java | AskTheCode

Problem in Java | Problem Solving | AskTheCode Question: Code: public class countHydraHead{ public static void main(String[] args) { int cut; for (cut = 1; cut <= 28 ; cut++) { headCount(cut); } System.out.println(cut); } static int headCount(int n){ int head = 1; return head*2; } }

View All
ATC Journa (10)
• ATC Learning Environment | AskTheCode