P2Cart Logo
A number is said to be Unique if a number's digits are not repeated.

This Java program checks whether all the digits of a given number are unique. If any digit is repeated, the program displays a message that the number is not unique.

Read more
A number is said to be Unique if a number's digits are not repeated. Write a program to accept a number and check whether the number is Unique or not. The program displays the message accordingly.
Sample Input: 5463
Sample Output: It is not a unique number.

Read Answer
A prime number is said to be ‘Twisted Prime’, if the new number obtained after reversing the digits is also a prime number.

This Java program accepts a number, checks whether it is a prime, reverses its digits, and then checks if the reversed number is also prime. If both conditions are met, it declares the number as a "Twisted Prime."

Read more
A prime number is said to be ‘Twisted Prime’, if the new number obtained after reversing the digits is also a prime number. Write a program to accept a number and check whether the number is ‘Twisted Prime’ or not.
Sample Input: 167
Sample Output: 761
761 is a ‘Twisted Prime’
Read Answer
Sample Input: 55 Sample Output: 55 is present in the Fibonacci series.

This Java program accepts a number from the user and checks whether it is present in the Fibonacci series. It displays an appropriate message based on the result.

Read more
Write a program to accept a number and check whether the number is present in the Fibonacci series or not. The program displays the message accordingly.
Sample Input: 55
Sample Output: 55 is present in the Fibonacci series.

Read Answer
Write a program to accept a number and display the frequency of each digit present in the number. Sample Input: 341124 Sample Output: The frequency of 1 = 2 The frequency of 4 = 2

A Java program to accept a number and display the frequency of each digit in the number. The program counts and outputs how many times each digit appears in the input.

Read more
Write a program to accept a number and display the frequency of each digit present in the number.

Sample Input: 341124

Sample Output: The frequency of 1 = 2

The frequency of 4 = 2

Read Answer
Accept a number and display the new number after removing all zeros. Sample Input: 5400207 & Sample Output: 5427

This Java program removes all zeros from a given number. It accepts a number from the user, processes it by eliminating any '0' digits, and then displays the new number.

Read more
Write a program to accept a number and display the new number after removing all zeros.
Sample Input: 5400207
Sample Output: 5427
Read Answer
Compute and display the sum of the following series: S = (1+2)/(1*2) + (1+2+3)/(1*2*3)+ ……. + (1+2+3+ …… + n)/(1*2*3*…..*n)

This Java program computes and displays the sum of a series where each term consists of the sum of integers from 1 to � n divided by the factorial of those integers. The user inputs the value of � n, and the program calculates the total sum of the series up to that value.

Read more
Write a program to compute and display the sum of the following series:

S = (1+2)/(1*2) + (1+2+3)/(1*2*3)+ …... + (1+2+3+ …… + n)/(1*2*3*…..*n)
Read Answer
The sum of odd numbers and the sum of even numbers for the first n natural numbers.

This Java program allows users to enter a positive integer � n and computes the sums of odd and even numbers within the range of 1 to � n. It uses a loop to iterate through the natural numbers, categorizing them as odd or even, and outputs the results in a user-friendly format. The program demonstrates fundamental programming concepts such as loops, conditional statements, and user input handling.

Read more
Write a program to calculate and print the sum of odd numbers and the sum of even numbers for the first n natural numbers.
Read Answer
Sum of negative numbers, sum of positive odd numbers and sum of positive even numbers from a list of numbers entered by the user.

This Java program allows users to input a series of numbers and computes the sums of negative numbers, positive odd numbers, and positive even numbers. The input process continues until the user enters zero, at which point the program terminates and displays the calculated sums.

Read more
Write a program to print the sum of negative numbers, sum of positive odd numbers and sum of positive even numbers from a list of numbers entered by the user. The list terminates when the user enters zero.
Read Answer
Accept a number and display the sum of its digits. Sample Input: 542 & Sample Output: 5 + 4 + 2 = 11

This Java program accepts a number from the user, calculates the sum of its digits, and displays the breakdown of the addition process. For example, if the user inputs 542, the program will output 5 + 4 + 2 = 11. It demonstrates basic operations with integers and string manipulation in Java.

Read more
Write a program to accept a number and display the sum of its digits.
Sample Input: 542
Sample Output: 5 + 4 + 2 = 11

Read Answer
Write a program to find the factors of a number including 1 and the number itself. Sample Input: 18 & Sample Output: 1, 2, 3, 6, 9, 18

This Java program allows users to input a number and calculates its factors, including 1 and the number itself. For example, if the user inputs 18, the program will output 1, 2, 3, 6, 9, 18, demonstrating how to find and display the factors of any integer.

Read more
Write a program to find the factors of a number including 1 and the number itself.
Sample Input: 18
Sample Output: 1, 2, 3, 6, 9, 18

Read Answer
Write a program to display all the prime numbers from 1 to 100.

This Java program prints all the prime numbers between 1 and 100 by using a loop and a prime-checking method that checks for divisibility of numbers.

Read more
Write a program to display all the prime numbers from 1 to 100.
Read Answer
Write a program to find the factorial of 10.

A simple Java program to calculate and display the factorial of 10. The program uses a loop to compute the factorial and prints the result.

Read more
Write a program to find the factorial of 10.

[Factorial of 10! = 10*90*807….1]

Read Answer
Write a program to display the first ten terms of the series.

This Java program computes and displays the first 10 terms of the mathematical series: � = ( 1 + 2 ) ( 2 ∗ 3 ) + ( 2 + 3 ) ( 3 ∗ 4 ) + ⋯  for 10 terms . S= (2∗3) (1+2) ​ + (3∗4) (2+3) ​ +⋯ for 10 terms.

Read more
Write a program to display the first ten terms of the series.
Read Answer
Find the sum of the series. S = (1+2)/(2*3) + (2+3)/(3*4) + (3+4)/(4*5)……to n

A Java program that calculates the sum of the series � = ( 1 + 2 ) ( 2 ∗ 3 ) + ( 2 + 3 ) ( 3 ∗ 4 ) + ⋯ S= (2∗3) (1+2) ​ + (3∗4) (2+3) ​ +⋯ up to n terms, where n is provided by the user.

Read more
Write a program in Java to find the sum of the series.

S = (1+2)/(2*3) + (2+3)/(3*4) + (3+4)/(4*5)………to n

Read Answer
Find the sum of the series, taking the value of ‘a’ and ‘n’ from the user. S = 1 + a2/1! + a3/2! + a4/3! + …… + to n

A Java program that calculates the sum of the series � = 1 + � 2 1 ! + � 3 2 ! + � 4 3 ! + ⋯ S=1+ 1! a 2 ​ + 2! a 3 ​ + 3! a 4 ​ +⋯ up to n terms, where a and n are provided by the user.

Read more
Write a program in Java to find the sum of the series, taking the values of ‘a’ and ‘n’ from the user.

S = 1 + a2/1! + a3/2! + a4/3! + …….. + to n

Read Answer
A number is said to be Armstrong if the sum of digits equals the original number. Sample: 153 & Sample: 153 is an Armstrong Number because 13 + 53 + 33 = 153

This Java program checks if a given number is an Armstrong number by calculating the sum of its digits raised to the power of the number of digits and comparing it with the original number.

Read more
Write a program in Java to enter a number and check whether the number is an Armstrong or not.
A number is said to be Armstrong if the sum of digits equals the original number.
Sample: 153
Sample: 153 is an Armstrong Number because 13 + 53 + 33 = 153
Read Answer
Write a program in Java to enter a number and check whether the number is a Palindrome or not.

This Java program checks if a given number is a Palindrome by reversing its digits and comparing it with the original number. If they are equal, it confirms that the number is a Palindrome.

Read more
Write a program in Java to enter a number and check whether the number is a Palindrome or not.
A number is said to be a Palindrome if the new number obtained after reversing the digits is the same as the original number.
Sample Input: 232
Sample Output: 232 is a Palindrome Number.
Read Answer
Write a program to enter a number and check whether the number is ‘Neon’ or not. A number is said to be ‘Neon’, if the sum of the digits of the square of a number is equal to the number itself.

This Java program checks if a given number is a Neon number. A Neon number is defined as a number where the sum of the digits of its square is equal to the number itself. For instance, for the input number 9, since 9 2 = 81 9 2 =81 and 8 + 1 = 9 8+1=9, it is identified as a Neon number.

Read more
Write a program to enter a number and check whether the number is ‘Neon’ or not. A number is said to be ‘Neon’, if the sum of the digits of the square of a number is equal to the number itself.

Sample input: 9

Sample Output: 9*9 = 81, + 1 =9

: 9 is a Neon number.

Read Answer
Write a program in Java to display first 50 Prime number a given number.

This Java program finds and displays the first 50 prime numbers, utilizing a method to check the primality of each number efficiently. It demonstrates basic programming concepts such as loops, conditionals, and methods.

Read more
Write a program in Java to display the first 50 Prime numbers a given number.
Read Answer
Write a program in Java to find the sum of given series S = 1 + 1/2! + 1/3! + 1/4! + …… + 1/10!

This Java program calculates the sum of the series � = 1 + 1 2 ! + 1 3 ! + … + 1 10 ! S=1+ 2! 1 ​ + 3! 1 ​ +…+ 10! 1 ​ using the BigDecimal class for precision in arithmetic operations involving factorials. The program demonstrates the use of loops and methods in Java to compute mathematical series.

Read more
Write a program in Java to find the sum of a given series

S = 1 + 1/2! + 1/3! + 1/4! + ……… + 1/10!

Read Answer