A prime number (or a prime) is a natural number greater than 1 that can only be divided by 1 and itself.

Ex-First few Prime number are-

2, 3, 5, 7, 11, 13, 17, 19,...

A digit prime is a prime number whose sum of digits is also prime.

For example the prime number 23 is a digit prime because 2+3=5 and 5 is a prime number. 17 is not a digit prime because 1+7 = 8, and 8 is not a prime number. Write a program to find out the number of digit primes within a certain range less than 1000000.and also print the Mth digit prime number between the range.

**

jackey.jay.9
0
Newbie Poster

## Recommended Answers

Jump to PostSomething like this?

`#include <stdio.h> #include <math.h> #include <stdbool.h> #define LOWER_BOUND (0) #define UPPER_BOUND (1000000) // Not inclusive. typedef void (*prime_callback)(unsigned int); static unsigned int digit_prime_count = 0; static const unsigned int M = 10; // Starting from 1. bool is_prime(const unsigned int n) { int i; …`

Jump to PostShowing once again why volunteering a program, without the original poster doing any work whatsoever, is a bad idea.

Whether it's homework, or a problem solving website like SPOJ or Euler Project, having us code up a gratis program for them, is just wrong. They did none of the work.

…

## All 8 Replies

Gonbe
32
Newbie Poster

bhavesh123
0
Newbie Poster

Gonbe
32
Newbie Poster

saira.sultana.16
0
Newbie Poster

Suriya_1
0
Newbie Poster

Gonbe
32
Newbie Poster

Adak
419
Nearly a Posting Virtuoso

iamthwee
commented:
nods
+14

Gonbe
32
Newbie Poster

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.