Finding Reverse of a Number | Java | Detailed Explanation

preview_player
Показать описание

Subscribe to my channel so that you do not miss any topic.

My other videos-

Рекомендации по теме
Комментарии
Автор

Extremely good explanation it became like crystal clear for

Anikets_Art_Gallery
Автор

beautiful explanation...better than other YouTubers! thanks much

wheresisgod
Автор

Sir upload Java full concept video. It is very much useful for us.

shanthinij
Автор

Thank you so much, RESPECT from karnataka

mithank
Автор

After a Long Gap u are back....thanks for the video bro🤩

aarulmozhinandhini
Автор

thank god i watched ur video i understood the logic so well thank u so much

payalbhuyan
Автор

bro your explaination is great thank you so much🙏

ashishraj
Автор

Awesome bro.. how did you learn this deeper....Keep up this work....

shivu
Автор

Awesome explanation brother. We need more videos from you.

techbaap
Автор

But if user enter 100, we get output 1 and not as 001....how can we solve this?

rajeshkanna
Автор

Soo... Palindrome number and reverse a given number are same?

coctamizhan
Автор

Bro please explain string programs also

abhiram
Автор

Class reverse {
Public static void main (string[]args){
Int n=1234, r;
While(n>0)
{
r=n%10;
System.out.print (r);
r=n/10;
}

}
}

zhawu
Автор

public class Playground {

public static void main(String[] args) {
final var number = -102;




}

// Will not work for negative numbers
private static int reverse0(final int number) {
if (number >= 0 && number <= 9)
return number;

final int power = 10;
int input = number;
int reverse = 0;

while (input > 0) {
int lastDigit = input % 10;
reverse = reverse * power + lastDigit;
input /= 10;
}

return reverse;
}

private static int reverse1(final int number) {
if (number >= 0 && number <= 9)
return number;

final int power = 10;
final boolean isNegative = number < 0;
int input = isNegative ? number * -1 : number;
int reverse = 0;

while (input > 0) {
int lastDigit = input % 10;
reverse = reverse * power + lastDigit;
input /= 10;
}

return isNegative ? reverse * -1 : reverse;
}

private static int reverse2(final int number) {
if (number >= 0 && number <= 9)
return number;

final int power = 10;
int input = number;
int reverse = 0;

while (input != 0) {
int lastDigit = input % 10;
reverse = reverse * power + lastDigit;
input /= 10;
}

return reverse;
}

// Same as above but less lines
private static int reverse3(int number) {
if (number >= 0 && number <= 9)
return number;

int reverse = 0;
while (number != 0) {
int lastDigit = number % 10;
reverse = reverse * 10 + lastDigit;
number /= 10;
}
return reverse;
}
}

ravi
Автор

You need +Reverse to print the number right?

ashishmj
Автор

please make a series in pattern printing program and one solution with explaination of this pattern
1 2 3 4 5
10 9 8 7 6
11 12 13 14 15
20 19 18 17 16

manojkumar-ifxu
Автор

The above method of reversing a number won't work if the last digit os number is 0 .
e.g: 5430
Can you please tell me how to achieve that

rm.
Автор

Good
But it would be better if you've done it neatly.

amanmahato
Автор

Bro simple ah reverse for loop laye potrulame why this much explanation. For(int i=array.length-1;i>=0;i--){
}

venkatvenkat