# Number splitted in several that add up that number - Problem

Hi, I´m trying to make a code that given a number lower than 900, it splits that number into “x” (variable) ammount of numbers from range 1 to 99, that are different each other and add up that initial number.

(by different each other I mean not divide 100 into 25, 25, 25 ,25. But it could be like 25, 30, 5, 25, 15.)

I have made a code that splits that initial number into several already, but I can´t specify into the ammount of numbers that it is splitted.

The idea is that the app gives you options possibles to split and you choose, for example, you enter number 100 and it gives you choices possibles like:

split in 2, 3, 4, etc. (from the minimun possible to a maximum lower than 10)

always the splitted numbers must be lower than 99.

Here is what I done

“txt_number_spread” is the given number by the user, like 350. “suma_parcial_Addition” is the acumulative of each random integer generated.

it´s a loop that keep adding random numbers form 1 to 99 until it reaches the total number given. If the last generated plus the acumulated addition is larger than the original number, it rest the original number from the acumulated addition and add that number.

But as I said, I can´t specify the ammount I want to divide.