In this video you will learn about how to perform reverse of a string using while loop
I have tried to explain the logic of how reverse of a number is performed.
Making this interview Series especially for freshers who wants to crack coding round on java and selenium
Please check this play list for Interview Series on Selenium + Java
Β Β Β β’Β π°ππππππππΒ π·ππππππππππΒ IIΒ SeleniumΒ +Β J...Β Β
Code :
*****************************
Reverse of a String :
*****************************
package interviewQuestionsOnJava;
public class Reverse_of_a_Number_using_whileLoop
{
public static void main(String args[])
{
int number =1234;
int reverse = 0;
// for storing the result and initially made it to be 0;
while(number!=0)
{
int rem=number%10; //Step -1
System.out.println("Now remainder is : " + rem );
reverse = reverse*10 + rem; //Step -2
System.out.println("Now reverse is : " + reverse );
number=number/10; //Step -3
System.out.println("Now Number is : " + number );
}
System.out.println("*************************************");
System.out.println("Reverse of a Number is : " + reverse );
}
}
Watch video π°ππππππππ π·ππππππππππ II Selenium + Java II π·ππ ππ πππππππ πππππππ ππ π ππππππ πππππ π ππππ ππππ online without registration, duration hours minute second in high quality. This video was added by user Knowledge Share 22 March 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 14 once and liked it people.