GENERAL DESCRIPTION
A prime number is an integer greater than 1 whose only integer factors are 1 and itself. A right-truncatable prime number (or right-prime number) is a prime number that remains prime as each of its rightmost digits is removed. For example, consider the value 719. 719 is prime, 71 is prime, and 7 is prime. Thus, 719 is a right-prime number.
Alternatively, consider the value 97. Although 97 is prime, 9 is not. Thus, 97 is not a right-prime number. (Source: The Prime Pages, http://www.utm.edu/research/primes/).
In order to receive any credit on this program, you must provide a detailed, correct algorithm. This algorithm will be judged more critically than the previous algorithm. If you are still unsure about writing algorithms, you may use the example given on pages 73 - 75 in your textbook as a guideline. As in that example, your algorithm should indicate where in your program you will use loops, where you will use decision statements, and what computations you will make.
The input to the program is a single integer y. The input value may be any number between 2 and 231-1 ( 2,147,483,647), inclusive. Given an input value y, write a program that determines if y is right-prime.
Your program should produce exactly one line of text as output which indicates whether y is a right-prime. The main function should input the value from stdin and output the text to stdout.
The conversion from input to output should be performed in a different function called isRightPrime. This function should accept an integer parameter which will be the value to test to see if it is right-prime. In addition, this function should return an integer value that equals 1 if the number is right-prime and 0 if it is not right-prime. This function will need the ability to determine if successive values are prime, so it should call the isPrime function described below.
The isPrime function should accept an integer parameter, x, which will be the value to test to see if it is prime. In addition, this function should return an integer value that equals 1 if x is prime and 0 if x is not prime to isRightPrime.

Is this your directions for the program?

Yes I am unsure how to go about doing this program

I only pasted the directions so I won't have to spend so much time typing it out. I stared on the problem already I just need help doing the algorithm for this program.

well this is the way i started. (how do i do a toggle plain text?)

// imports
#include <stdio.h>
#include <math.h>
#include<stdlib.h>
double isRightPrime();
double isPrime();

// begin main
int main()
{
 // declare variables 
    double rightPrime;
    double Prime;

Edited 3 Years Ago by mike_2000_17: Fixed formatting

Well, how about reading in the input and passing it to rightPrime. Make isPrime just return 1. Make rightPrime just call isPrime and return the value. Then harness that return in main and display a result. That gives you a skeleton. Then write isPrime and get it working. Then write rightPrime and you're done.

Right off the bat, these don't match the spec:

double isRightPrime();
double isPrime();

Read the spec carefully and make them match. What are they supposed to return? What do they take as parameters?

Comments
That knock really wasn't necessary.
thank you

thank you for helping me.

would I us a do while loop of the for loop in processing section

This article has been dead for over six months. Start a new discussion instead.