/* emirp_1000.c j. adams
*
* Program to generate prime numbers that are emirps
*
*
* compile with $> gcc -o emirp_1000 emirp_1000.c -lm
*
*
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define MAX_RANGE 1000
int main(void)
{
int p = 11;
int p2 = 0;
int itr = 0;
int cnt = 0;
int rev = 0;
int skip_val[]= {2, 4, 2, 2, 2, 4, 2, 2, 2, 4, 2, 2, 2, 4, 2, 2};
while(p < MAX_RANGE)
{
cnt = 16;
itr = 0;
while(cnt--)
{
// check p for primeness.
if(isit_prime(p))
{
p2 = p;
// reverse p
while(p2 > 0)
{
rev = rev * 10 + (p2 % 10);
p2 = p2/10;
}
// If rev != p (palindrome) and rev is prime
if((rev ^ p)&&(isit_prime(rev)))
printf("\n%d", p);
}
rev = 0;
p = p += skip_val[itr++];
}
}
printf("\n");
return 0;
}
int isit_prime(int n)
{
int k = 0;
if (n 0)
return 0;
return 1;
}
write a lex program to delete space from the program
How to write a program for mouse in microprocessor?
To write a C++ program to display the student details using class and array of object.
Q.1 Write a program to print first ten odd natural numbers. Q.2 Write a program to input a number. Print their table. Q.3 Write a function to print a factorial value.
how to write a program that counts automorphic number from 1 to 999
VBnet program to find the prime numbers between 100 to 200?
You can use int i; for (i = 10; i <= 50; i += 2) {//print i} as a program to print even numbers between 10 and 50.
It is 180,001.
All of the whole numbers between one and a billion. Honestly, we're not robots here. Write a program and do it yourself, if you really need them.
write a lex program to delete space from the program
write an assembly language program to find sum of N numbers
write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? check bellow link http://bashscript.blogspot.com/2009/08/gcd-of-more-than-two-numbers.html
fdsgfhgdfhgdf
How to write a program for mouse in microprocessor?
for (int i = 2; i < 10; i ++) printf("%d\n", i); You did say even and odd numbers between 1 and 10. That's allnumbers between 1 and 10.
program to find maximum of two numbers using pointers
please somebody should help me answer this question..I have a project on it even! It seems almost impossible at the moment.