how to make this program if a five-digit number is input through the keyboard, write a program to reverse the number.
What Language? In java: \\enter a send a string as a parameter, then return it's reverse. public String reverse(String number) { \\It's easiest if you use a string instead of a int. String answer = ""; for(int i = number.length-1; i>=0; i--) { \\gets the last char of number and adds it to answer. Then it moves down to the next char answer.concat(number.substring(i)); } return answer; } That should work. I didn't test it,
Is it C or C++ or Java
the program in c is attached here
My answer was in java.
if u want to do this program in java simply use reverse method, it will be easy..
Join our real-time social learning platform and learn together with your friends!