Nearest Multiple of 10

You have been given an integer 'N'. Find the nearest multiple of 10 to the given integer 'N'.

Note:
If there are multiple answers, find the smallest one. For example, if N = 35, both 30 and 40 are nearest to N, since 30 is smaller, the expected answer will be 30.
Input Format:
The first line contains an integer 'T' which denotes the number of test cases or queries to be run. Then the test cases follow.

The first and only line of each test case or query contains the integer 'N' for which you have to find the nearest multiple of 10.
Output Format:
For each test case, print a single line containing a single integer denoting the nearest multiple of 10.

The output for every test case will be printed in a separate line.

Note:

You are not required to print the expected output, it has already been taken care of. Just implement the given function. 
Constraints:
1 <= T <= 10 ^ 5
0 <= N <= 10 ^ 9

Time Limit: 1 sec.
CodingNinjas
author
2y
Nearest two multiples

Every integer has two candidates for the nearest multiple of 10. One is less than or equal to the given number and the other is greater than it.

For example, if the given integer i...read more

Help your peers!
Add answer anonymously...
GreenClouds Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter