Can anyone help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

23rd Apr 2022, 5:27 PM
GEORGE EGYIR MAYNE
GEORGE EGYIR MAYNE - avatar
45 Answers
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); } }
1st May 2022, 8:47 PM
Mi-Ⓜ️ohamed
Mi-Ⓜ️ohamed - avatar
+ 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++; }
24th Apr 2022, 3:00 PM
Denise Roßberg
Denise Roßberg - avatar
+ 2
i recommend you to take a look at this code https://code.sololearn.com/cPhq95CH48WY/?ref=app
25th Apr 2022, 1:16 PM
Roni Berlin
Roni Berlin - avatar
+ 1
https://code.sololearn.com/c3kye42bRvKq/?ref=app
23rd Apr 2022, 9:10 PM
GEORGE EGYIR MAYNE
GEORGE EGYIR MAYNE - avatar
+ 1
Working on another will post for corrections
23rd Apr 2022, 9:23 PM
GEORGE EGYIR MAYNE
GEORGE EGYIR MAYNE - avatar
+ 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(); }
24th Apr 2022, 2:39 PM
Denise Roßberg
Denise Roßberg - avatar
+ 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.
24th Apr 2022, 3:50 PM
Denise Roßberg
Denise Roßberg - avatar
+ 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.
24th Apr 2022, 6:06 PM
Mi-Ⓜ️ohamed
Mi-Ⓜ️ohamed - avatar
+ 1
Thanks🌹 to everyone who helped solve the problem👏
24th Apr 2022, 6:08 PM
Mi-Ⓜ️ohamed
Mi-Ⓜ️ohamed - avatar
+ 1
Nawti Nana What do you mean?
24th Apr 2022, 7:40 PM
Denise Roßberg
Denise Roßberg - avatar
+ 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
25th Apr 2022, 6:02 PM
Adabe Desmond
+ 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]); } }
25th Apr 2022, 8:03 PM
Adabe Desmond
+ 1
Thanks
26th Apr 2022, 8:59 AM
Adabe Desmond
+ 1
Please give me the explanation of the code
26th Apr 2022, 8:59 AM
Adabe Desmond
+ 1
Why is the arr.length-1
26th Apr 2022, 9:17 AM
Adabe Desmond
+ 1
arr.length-1 is the last index of array
26th Apr 2022, 10:31 AM
Roni Berlin
Roni Berlin - avatar
27th Apr 2022, 8:24 PM
GEORGE EGYIR MAYNE
GEORGE EGYIR MAYNE - avatar
+ 1
I have been able solve it
27th Apr 2022, 8:29 PM
GEORGE EGYIR MAYNE
GEORGE EGYIR MAYNE - avatar
+ 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
1st May 2022, 7:14 PM
GEORGE EGYIR MAYNE
GEORGE EGYIR MAYNE - avatar
0
With what? What's the question?
23rd Apr 2022, 7:34 PM
Mustafa A
Mustafa A - avatar