Write a program that does a magic trick C Overview We will w

Write a program that does a magic trick. C++

Overview: We will write a program that does a magic trick. Pick two people to create a mental link between (Person A and Person B for these instructions) Have both people secretly write down a number between 1-9. Have Person A turn away and let Person B show the audience his secret number. Have Person A secretly do the following steps: Double their secret number Add two to the result Multiply the result by five Subtract a magic number (10-Person B\'s number) Have Person A read out the second digit of number they computed. Instead of being the Magician, write a program that gives all the correct instructions. Your input and output can be whatever you want as long as it completes the trick.

Solution

#include <iostream>

using namespace std;

int main()
{ int n1,n2,a,b,c,s;
cout << \"enter the secrete number of A\" << endl;
cin >>n1;
cout << \"enter the secrete number of B\" << endl;
cin >>n2;
a=n1*2;
b=a+2;
c=b*5;
s=c-n2;
while (s >= 100)
{
s /= 10;
}
s=s%10;
cout << s;

}

Write a program that does a magic trick. C++ Overview: We will write a program that does a magic trick. Pick two people to create a mental link between (Person

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site