Answer to Question #309583 in C++ for gabo

Question #309583

Write a program that will ask the user to enter the Atomic Number of an element and check if it is a precious metal according to the list below:

 

Atomic Number 47: Silver

Atomic Number 78: Platinum

Atomic Number 79: Gold

 

Output Possibility #1 (One of the three precious metals):

 

Enter an atomic number to see if it is a precious metal:   [user types: 47]

47 is the atomic number for Silver

 

Output Possibility #2 (NOT a precious metal):

 

Enter an atomic number to see if it is a precious metal:   [user types: 50]

50 is not an atomic number for a precious metal


1
Expert's answer
2022-03-11T07:24:04-0500


#include <iostream>


using namespace std;


int main() {
	int atomicNumber;
	cout<<"Enter an atomic number to see if it is a precious metal: ";
	cin>>atomicNumber;
	if(atomicNumber==47){
		cout<<atomicNumber<<" is the atomic number for Silver\n";
	}else if(atomicNumber==78){
		cout<<atomicNumber<<" is the atomic number for Platinum\n";
	}else if(atomicNumber==79){
		cout<<atomicNumber<<" is the atomic number for Gold\n";
	}else{
		cout<<atomicNumber<<" is not an atomic number for a precious metal\n\n";
	}




	system("pause");
	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