Answer to Question #273036 in C++ for gege

Question #273036

Did you know that in lotteries, a 3-digit number with the same numbers in all digits like 777 will hit the jackpot in a casino? In the same manner, let's make a program that will test if a certain 3-digit number hits a jackpot or not by identifying if all the digits of a given number is the same as the second inputted number. If it is, print "Jackpot!"; else, print "Nah".


Let's try this out now!


Input


1. 3-digit number

2. Digit to be checked

Output


The first line will contain a message prompt to input the 3-digit integer.

The second line will contain a message prompt to input the digit to be checked.

The last line contains the appropriate string.


1
Expert's answer
2021-11-29T02:46:28-0500
#include <iostream>


using namespace std;


int main()
{
    int n1,n2,n3;
    cout << "Enter the first number" << endl;
    cin>>n1;
    cout << "Enter the second number" << endl;
    cin>>n2;
    cout << "Enter the third number" << endl;
    cin>>n3;
    if (n1==n2 && n1==n3)
    {
     cout<<"Jackpot!"<<endl;
    }else{
    cout<<"Nah"<<endl;
    }
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS