0
Can anyone help
Write a program to convert numbers. The user should be able to select from a menu option and enter the number to convert. The program must do the conversion and display output. After that, the program must ask if the user wants to perform another conversion without exiting 1. Decimal to Binary 2. Binary to Decimal
45 Respuestas
0
Dear, GEORGE EGYIR MAYNE
The Solution Below ⬇️
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
long rev = 0;
long x, y;
System.out.println("Enter the Numbers");
long num = input.nextLong();
while(num!=0){
long renum = num % 10;
//x = num % 10;
rev = rev * 10 + renum;
num = num / 10;
}
System.out.println("Reveresed is: " + rev);
}
}
+ 2
print() -> same line
println() -> next line
while (count <= 100) {
if (isPrime(g) && isPalindrome(g)) {
count++;
System.out.print(g + " ");
if(count %10==0){
System.out.println();
}
}
g++;
}
+ 2
i recommend you to take a look at this code
https://code.sololearn.com/cPhq95CH48WY/?ref=app
+ 1
https://code.sololearn.com/c3kye42bRvKq/?ref=app
+ 1
Working on another will post for corrections
+ 1
Nawti Nana
//to print each palindromic prime
System.out.print(g + " ");
//add a line break when counter gets 10, 20, ...
if(counter % 10 == 0){
System.out.println();
}
+ 1
Nawti Nana
I think you have trouble with the input form on sl.
At first you need to enter length of list1, then the values.
Then press enter and input the length of list2 and the values.
3 1 2 3 [enter]
3 1 2 3
Run your code.
+ 1
Why is the question evaluated as not serious, no matter how easy or difficult or even unclear the question is? If you know the answer and can help, help without a bad rating and give it a good rating , so be supportive.
+ 1
Thanks🌹 to everyone who helped solve the problem👏
+ 1
Nawti Nana
What do you mean?
+ 1
I don't how to go about it..
Any help
Write a program to take a string as input and output its reverse.
The given code takes a string as input and converts it into a char array, which contains letters of the string as its elements.
Sample Input:
hello there
Sample Output:
ereht olleh
+ 1
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String text = scanner.nextLine();
char[] arr = text.toCharArray();
char b[];
for( int a=arr.length; a>0;a++)
{
b[a]=array[a];
System.out.println(b[a]);
}
}
+ 1
Thanks
+ 1
Please give me the explanation of the code
+ 1
Why is the arr.length-1
+ 1
arr.length-1 is the last index of array
+ 1
I have been able solve it
+ 1
Now display the numbers in the reverse order with each number on a new line.
Anyone to help pls
https://code.sololearn.com/cTgaWFQJBhUz/?ref=app
0
With what? What's the question?