Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // program.cpp : Defines the entry point for the console application.
- //libraries
- #include "stdafx.h"
- #include <iostream>
- #include <string>
- #include <cstdlib>
- #include <math.h>
- using namespace std;
- int _tmain(int argc, _TCHAR* argv[])
- {
- int input1, input2, new1, new2, temp, counter = 0;
- cout << "Enter the 1st number: ";
- cin >> input1;
- new1 = input1;
- cout << "Enter the 2nd number: ";
- cin >> input2;
- new2 = input2;
- cout << endl;
- cout << input1 << " " << input2 << " ";
- do {
- counter++;
- temp = (new1 + new2) % 10;
- cout <<temp << " ";
- new1 = new2;
- new2 = temp;
- } while (!(new1 == input1 && new2 == input2));
- cout <<endl <<"It took " << counter << " steps to close the necklace." <<endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement