Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Can someone help me with this coding problem?

–2 votes
asked May 10 by Nedelea Claudiu (230 points)
I need a program that takes an int from the user and prints the smallest number if one digit is removed,

preferably written in C++.

Thank you

2 Answers

0 votes
answered May 11 by Rupinder Goyal (140 points)
+1 vote
answered May 11 by Peter Minarik (34,450 points)
edited May 11 by Peter Minarik

This looks like an assignment to me.

Your best interest is to try to solve the problem yourself. Give it your best shot.

If you get struck, post your solution and we can point out what the problem is.

Good luck! :)

Okay, I won't let you go "empty handed".

Here are some pointers:

  • You can do the programming part. If you've never done any C++, check out some tutorial. E.g.: https://www.w3schools.com/cpp/
  • The maths part is a bit tricky. Mostly, because the problem description is not really specific: "prints the smallest number if one digit is removed". What does this mean?
    Let's assume you have a number 321. What is "the smallest number if one digit is removed"? Is it [32]1? Is it 3[21]? Or [31] by removing 2 from the middle? Or can it be [12] by removing 3 and reordering the digits?
    Anyway, you need to first find out what you need to do. Then you can think about how the maths work. Then write the code for it.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.