Google[^] is your friend!

First result: Find the Missing Number - GeeksforGeeks[^]

[EDIT]

For missing numbers in string, check this: Find the missing number in a string of numbers with no separator - GeeksforGeeks[^]

15,902,447 members

See more:

Hello guys,

There is a problem about java i need to solve. The user provides a string which has numbers in it. One of the numbers is missing. The first and the last number can be between -9999 and 9999 and the difference can be between -99 and 99. My program should print the missing number.

Here are some examples:

510152030

25

567566565564563562561560559557556555554

558

828588919497100103106112115118121

109

-45-35-25-55152535455565

-15

I only have a basic knowledge in java.( while,for,if)

I don't want to use break,continue,switch

I would appreciate your help...

**What I have tried:**

I could not try anything because my code gets too long.

There is a problem about java i need to solve. The user provides a string which has numbers in it. One of the numbers is missing. The first and the last number can be between -9999 and 9999 and the difference can be between -99 and 99. My program should print the missing number.

Here are some examples:

510152030

25

567566565564563562561560559557556555554

558

828588919497100103106112115118121

109

-45-35-25-55152535455565

-15

I only have a basic knowledge in java.( while,for,if)

I don't want to use break,continue,switch

I would appreciate your help...

I could not try anything because my code gets too long.

Comments

Google[^] is your friend!

First result: Find the Missing Number - GeeksforGeeks[^]

[EDIT]

For missing numbers in string, check this: Find the missing number in a string of numbers with no separator - GeeksforGeeks[^]

First result: Find the Missing Number - GeeksforGeeks[^]

[EDIT]

For missing numbers in string, check this: Find the missing number in a string of numbers with no separator - GeeksforGeeks[^]

Permalink

Share this answer

v2

Comments

Member 14048022
11-Feb-19 11:27am

Hello,

There are no arrays in my question. However, thank you for responding.

There are no arrays in my question. However, thank you for responding.

Maciej Los
11-Feb-19 11:29am

CPallini
11-Feb-19 15:46pm

5.

Maciej Los
11-Feb-19 16:21pm

Thank you, Carlo.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject,
20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8
+1 (416) 849-8900

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!

Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

My problem is that i can't find a starting point.

Thank you for your response.