Nearest Multiple of 10 Problem Statement
Given an integer N
, find the nearest multiple of 10. If there are multiple nearest multiples, return the smallest one.
Input:
The first line contains an integer 'T', denoting the number of test cases. Each test case contains an integer 'N', for which you need to determine the nearest multiple of 10.
Output:
For each test case, output a single integer representing the nearest multiple of 10.
Example:
Input:
3
28
35
44
Output:
30
30
40
Explanation:
For N = 28, the nearest multiple of 10 is 30. For N = 35, both 30 and 40 are nearest, but since 30 is smaller, return 30. For N = 44, the nearest multiple of 10 is 40.
Constraints:
1 ≤ T ≤ 10^5
0 ≤ N ≤ 10^9
- Time Limit: 1 sec.

AnswerBot
4mo
Given an integer, find the nearest multiple of 10. If multiple nearest multiples, return smallest one.
Iterate through each test case
Calculate the remainder when dividing N by 10
If remainder is less th...read more
Help your peers!
Add answer anonymously...
GreenClouds Software Developer interview questions & answers
A Software Developer was asked Q. Kth Largest Element Problem Given an array containing N distinct positive intege...read more
A Software Developer was asked Q. Alternate Print Problem Statement You are given two strings "A" and "B". The tas...read more
A Software Developer was asked Q. Nearest Multiple of 10 Problem Statement Given an integer N, find the nearest mu...read more
Popular interview questions of Software Developer
A Software Developer was asked Q1. Kth Largest Element Problem Given an array containing N distinct positive intege...read more
A Software Developer was asked Q2. Alternate Print Problem Statement You are given two strings "A" and "B". The tas...read more
A Software Developer was asked Q3. Nearest Multiple of 10 Problem Statement Given an integer N, find the nearest mu...read more
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

