
Concept explainers
In C++, write a

PROGRAM:
//Header files
#include <iostream>
//Using namespace
using namespace std;
//Defining the main
int main() {
//Declaring variables
int n1,n2,n3;
//Getting input from the user
cout<<"Enter the three numbers:"<<endl;
cin>>n1>>n2>>n3;
//Checking for distinct numbers
if(((n1!=n2) && (n1!=n3)) && ((n2!=n1) && (n2!=n3)) && ((n3!=n1) && (n3!=n2)))
//Printing the output
cout<<"All the numbers are distinct";
//Checking for same numbers
else if((n1==n2) && (n1==n3))
//Printing the output
cout<<"All numbers are the same";
//Checking for duplicates
else if((n1==n2)||(n1==n3)||((n2==n1)||(n2==n3))||(n3==n1)||(n3==n2))
//Printing the output
cout<<"There are two are duplicated numbers.";
}
Step by stepSolved in 4 steps with 3 images

- Write a C++ that Ask user to enter an integer number and then determine whether the number is prime or not? Note: a number is prime that it is only divisible by 1 and itself. such as 3,5,7,13,..arrow_forwardPlease code using C++ and only use header <iostream>. Any other headers will not be accpeted. Thank you!arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





