1. ## Prime digits

I am doing multiplication of numbers such that every digits is a prime,
i don,t know what it the problem ....when i run my program ,i don,t get all prime...i don,t know where the problem is from.please help me tell me what i did wrong.

Code:
```
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>

bool check_prime(int);

int main(){

int flag=0;
int multiplicand, multiplier,result;
int partial_product1,partial_product2;

for ( multiplicand = 100; multiplicand <= 999; multiplicand++ ) {

for ( multiplier = 10; multiplier <= 99; multiplier++ ) {

int result = multiplicand * multiplier;
int digit51=result%10;
int digit52=result/10%10;
int digit53=result/100%10;
int digit54=result/1000%10;
int digit55=result/10000%10;
if((check_prime(digit51))==0)
continue;
if((check_prime(digit52))==0)
continue;
if((check_prime(digit53))==0)
continue;
if((check_prime(digit54))==0)
continue;
if((check_prime(digit55))==0)
continue;
int digit11=result%10;
int digit12=result/10%10;
int digit13=result/100%10;

if((check_prime(digit11))==0)
continue;
if((check_prime(digit12))==0)
continue;
if((check_prime(digit13))==0)
continue;

int digit21=result%10;
int digit22=result/10%10;

if((check_prime(digit21))==0)
continue;
if((check_prime(digit22))==0)
continue;

partial_product1 = multiplicand * digit21;
int digit31= partial_product1%10;
int digit32= partial_product1/10%10;
int digit33= partial_product1/100%10;
int digit34= partial_product1/1000%10;

if((check_prime(digit31))==0)
continue;
if((check_prime(digit32))==0)
continue;
if((check_prime(digit33))==0)
continue;
if((check_prime(digit34))==0)
continue;

partial_product2 = multiplicand * digit22;

int digit41= partial_product2%10;
int digit42= partial_product2/10%10;
int digit43= partial_product2/100%10;
int digit44= partial_product2/1000%10;

if((check_prime(digit41))==0)
continue;
if((check_prime(digit42))==0)
continue;
if((check_prime(digit43))==0)
continue;
if((check_prime(digit44))==0)
continue;

printf("             \n");
printf("             \n");
printf("%5d\n",multiplicand);
printf("\n");
printf("%5d\n",multiplier);
printf("-----\n");
printf("%5d\n",partial_product1);
printf("\n");
printf("%4d\n",partial_product2);
printf("-----\n");
printf("%d\n",result);
printf("             \n");
printf("             \n");

}

}
}

bool check_prime(int n)
{
if((n%2)==0){
return false;
}
int c=0;
for(int i=1;i<=n;i++)
{

if((n%i)==0)
{
c=c+1;
}

}
if(c==2)
{
return true;
}
}```

2. Originally Posted by code_lover
I am doing multiplication of numbers such that every digits is a prime,
i don,t know what it the problem ....when i run my program ,i don,t get all prime...i don,t know where the problem is from.please help me tell me what i did wrong.

Code:
```
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>

bool check_prime(int);

int main(){

int flag=0;
int multiplicand, multiplier,result;
int partial_product1,partial_product2;

for ( multiplicand = 100; multiplicand <= 999; multiplicand++ ) {

for ( multiplier = 10; multiplier <= 99; multiplier++ ) {

int result = multiplicand * multiplier;

int digit51=result%10;
int digit52=result/10%10;
int digit53=result/100%10;
int digit54=result/1000%10;
int digit55=result/10000%10;

if((check_prime(digit51))==0)
continue;
if((check_prime(digit52))==0)
continue;
if((check_prime(digit53))==0)
continue;
if((check_prime(digit54))==0)
continue;
if((check_prime(digit55))==0)
continue;

int digit11=result%10;
int digit12=result/10%10;
int digit13=result/100%10;
//shouldnt it be multiplicand

if((check_prime(digit11))==0)
continue;
if((check_prime(digit12))==0)
continue;
if((check_prime(digit13))==0)
continue;

int digit21=result%10;
int digit22=result/10%10; //shouldnt this be multiplier

if((check_prime(digit21))==0)
continue;
if((check_prime(digit22))==0)
continue;
//shouldnt this block be first...check the digits of multiplicand and multiplier for prime....

partial_product1 = multiplicand * digit21;
int digit31= partial_product1%10;
int digit32= partial_product1/10%10;
int digit33= partial_product1/100%10;
int digit34= partial_product1/1000%10;

if((check_prime(digit31))==0)
continue;
if((check_prime(digit32))==0)
continue;
if((check_prime(digit33))==0)
continue;
if((check_prime(digit34))==0)
continue;

partial_product2 = multiplicand * digit22;

int digit41= partial_product2%10;
int digit42= partial_product2/10%10;
int digit43= partial_product2/100%10;
int digit44= partial_product2/1000%10;

if((check_prime(digit41))==0)
continue;
if((check_prime(digit42))==0)
continue;
if((check_prime(digit43))==0)
continue;
if((check_prime(digit44))==0)
continue;

printf("             \n");
printf("             \n");
printf("%5d\n",multiplicand);
printf("\n");
printf("%5d\n",multiplier);
printf("-----\n");
printf("%5d\n",partial_product1);
printf("\n");
printf("%4d\n",partial_product2);
printf("-----\n");
printf("%d\n",result);
printf("             \n");
printf("             \n");

}

}
return 0;//ur type is int main()
}

bool check_prime(int n)
{
if((n%2)==0 && n!=2){//2 is prime
return false;
}
int c=0;
for(int i=1;i<=n;i++)
{

if((n%i)==0)
{
c=c+1;
}

}
if(c==2)
{
return true;
}
//there must be a return false..for c>2.
}```
check the things i have pointed out...can u give an example of such numbers....like tell the sample multplicand and multiplier which satisfies your condition...including the digits in partial and final product to b prime...is that even possible to find such a number....after i tweaked your program...i don't get any values...Are you sure there exists a valid sample....