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
#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;
}
}
Comments
Leave a comment