Need some help

1337hendrix's Avatar
Newbie Member
I need to convert the following code to Javascript.

I need to convert the following code to javascript.
Code:
#include <iostream>

int main ()
{
// Variables
short first;
short second;
short previous;
short current;
short help;

// Input and communication with the user
cout << "Insert the first digit: ";
cin >> first;
cout << "\n";
cout << "Insert the second digit: ";
cin >> second;
cout << "\n";
cout << "The necklace is: ";

// Preparing for the loop
previous = second;
current = (first + second)%10;
cout >> first;
cout >> second;

// And not the WHILE loop

while ( (previous != first) || (current != second) )
{
cout >> current;
help = previous;
previous = current;
current = (help + current)%10;
}

// Writing the last digit
cout >> current;

return 0;
}
Any help would be greatly appreciated.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Similar to C++ to JS (converting languages)