Answer to Question #295803 in C++ for Harsh

Question #295803

Take input of your registration number in the University using appropriate data type. Write a



programme to print all the prime number digits, each in a new line, in your registration



number

1
Expert's answer
2022-02-09T15:58:27-0500
#include<iostream>
#include<string>

using namespace std;

int main()
{
	string num[] = { "zero","one","two","three","four","five",
					"six","seven","eight","nine" };
	int value;
	cout << "Please, enter a value: ";
	cin >> value;
	int temp;
	while (value > 0)
	{
		temp = value % 10;
		cout << temp << " "<< num[temp] << endl;
		value = value/10;
	}
}	

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