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!
Select
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
GreenClouds Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
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

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

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits