
Asked in Juniper Networks
Reverse a Number Problem Statement
Create a program to reverse a given integer N
. The output should be the reversed integer.
Note:
If a number has trailing zeros, their reversed version should not include them. For example, the reverse of 10400 is 401, not 00401.
Input:
Integer N
Output:
Corresponding reverse number
Example:
Input:
1230
Output:
321
Constraints:
0 ≤ N < 10^8

AnswerBot
4mo
Reverse a given integer while excluding trailing zeros.
Create a program to reverse the given integer by converting it to a string and then reversing it.
Remove any trailing zeros from the reversed stri...read more
surbhi kumari
2y
Scanner s = new Scanner(System.in); int n = s.nextInt(); int rev =0; int rem =0; while(n>0){ rem = n%10; rev = (rev*10) + rem; n=n/10; } System.out.println(rev);
Help your peers!
Add answer anonymously...
Top Software Engineer Interview Questions Asked at Juniper Networks
Q. Implement your own hashmap.
Q. Write a program to reverse an integer.
Q. What is the difference between declaring an array int arr[5] and allocating memo...read more
Interview Questions Asked to Software Engineer at Other Companies
Top Skill-Based Questions for Juniper Networks Software Engineer
Algorithms Interview Questions and Answers
250 Questions
Data Structures Interview Questions and Answers
250 Questions
Web Development Interview Questions and Answers
250 Questions
Java Interview Questions and Answers
250 Questions
Software Development Interview Questions and Answers
250 Questions
SQL Interview Questions and Answers
250 Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

