Preview:
#include <iostream>
#include<cmath>
#include<ctime>
#include<string>
#include <iomanip>
#include <fstream>

using namespace std;


bool primeNumber(int n);
bool additivePrime(int n);
int sumOfDigits(int n);



int main()
{
	
	int count = 0;
	int number = 13;
	cout << setw(3) << "Prime number" << setw(20) << "Sum of its digits" << endl;
	for (int i = 2; i <= 70; i++)
	{
		if (primeNumber(i) && additivePrime(i))
			cout <<setw(1)<< i<<setw(15)<<sumOfDigits(i)<<endl;
	}
		

}
bool primeNumber(int n) {
	
		for (int i = 2; i <= n / 2; i++) {
			
			if (n % i == 0) {

				return false;
			}
		}
		return true;
}

bool additivePrime(int n)
{
	
	if (primeNumber(sumOfDigits(n)))
		return true;
	else
		return false;
}
int sumOfDigits(int n)
{
	int sum = 0, digit = 0;
	while (n != 0)
	{
		digit = n % 10;
		sum += digit;
		n /= 10;
	}
	return sum;
}






	
   




downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter