# Thread: difficult(4 me) mathematics program

1. ## difficult(4 me) mathematics program

ok this program is based on the number theory... it is know as the necklace program... i have tried every single way i can think of and am seeking some help

this is how it works

enter first number: 1
enter second number: 8

then we add 1+8= 9 then we add 8+9=17 and then removing the 1 resulting in the number 7 the next step is then to do 9+7=16 wich becomes 6 and so on until the necklace closes by repeating the beginning 1,8

1,8,9,7,6,3,9,2,1,3,4,7,1,8

plz help me! i repeat im not asking for freebies... i have worked on this a long time and am getting no-where

2. Code:
```int main(void)
{

short int num1;
short int num2;
short int temp;

cout << "Enter first number->";
cin >> num1;
cout << "Enter another number->";
cin >> num2;

do {
cout << "\n\n";

{
for (short int i = 0; i < 10; i++)
{
{
} else {

break;
}
}
} else {

}
{
}

cout << "It's almost like magic!\n";
cin >> num2;    // to pause program;
return 0;

}```

Remember, I'm not perfect, and I didn't test this code

3. Do your own hw. Post your code and then we'll help u with problems.

4. Originally posted by golfinguy4
Do your own hw. Post your code and then we'll help u with problems.
ok dude this is not a whinny help me do your homework post ok you wanna see my code? fine i will post it! keep in mind its falling apart i was in the process of tryin something new...

Code:
```#include <iostream.h>

int main()

{
int number1;
int number2;

cout<<"Enter one single-digit number: ";
cin>>number1;
cout<<"Enter one single-digit number: ";
cin>>number2;

cout<<endl;
cout<<number1<<number2;

int stonum1=1;
int stonum2=8;

while (((number1)!=(stonum2))&&((number2)!=(stonum1)))
{
stonum2=stonum1;
stonum1=((number1+number2)%10);
cout<<stonum1;
}

cout<<endl;

return (0);
}```
you happy now goldfinger?

many props to dual-catfish i will analyze your example and try to implement it into what i was working for thx dude!

5. No problem; I just hope I understood what you were asking. With a minimal amount of tinkering you should have it.

Did the first 2 numbers have to be 1 and 8? Or could they be anything?

6. the first two numbers are user inputed... well ill keep working on this once i get back to school i have too much physics work tnight

7. that is an interesting problem... weird how math works

8. Check this.

#include <iostream.h>

int main()

{
int number1;
int number2;

bool b1,b2;

b1=b2=false;

cout<<"Enter one single-digit number: ";
cin>>number1;
cout<<"Enter one single-digit number: ";
cin>>number2;

cout<<endl;
cout<<number1<<','<<number2;

int stonum1=number1;
int stonum2=number2;
int stonum;

while (b1!=true||b2!=true)
{
stonum=(stonum1+stonum2)%10;
cout<<','<<stonum;
stonum1=stonum2;
stonum2=stonum;
if(b1!=true&&stonum==number1)
{
b1=true;
continue;
}

if(stonum==number2)
{
b2=true;
continue;
}
b1=b2=false;
}
cout<<endl;
return 0;
}

9. ## Hello

Stop using people to do your homework do it yourself this forum is not intended for people to do everything for you, but only for people to give tips.

10. > Stop using people to do your homework do it yourself this forum is not intended for people to do everything for you, but only for people to give tips.

Chill out. They did post their code.