Access Millions of academic & study documents

A palindromic prime is a prime number that, when reversed, maintains

Content type
User Generated
Showing Page:
1/3
A palindromic prime is a prime number that, when
reversed, maintains the same value. For example, 11 is a
palindromic prime. Write a program that calculates and
displays all of the 3 -digit palindromic primes between 100
- 999 and the sum of all the primes listed. You are
expected to use a for-loop to iterate over all necessary
values. Your program should simply display a single
integer: the sum of all 3 -digit palindromic primes.
Note: You are not allowed to use functions to solve this
problem.
ex.
three digit prime, three digit prime, three digit prime, three
digit prime, three digit prime, three digit prime, three digit
prime, three digit prime, three digit prime, three digit
prime, three digit prime, three digit prime, three digit
prime, three digit prime, three digit prime, three digit
prime, three digit prime, three digit prime, three digit
prime, three digit prime, three digit prime, three digit
prime, three digit prime, three digit prime, three digit
prime, three digit prime, three digit prime, three digit
prime, three digit prime, three digit prime, three digit
prime, three digit prime, three digit prime, three digit
prime, three digit prime, three digit prime,
The summation of all the primes listed above is _____.
Grading
25pts - Correctly Iterate over required values using for-
loop
25pts - Correctly determine whether a number is prime
25pts - Correctly determine whether the number is a
palindrome
25pts - Aggregate the value of all prime numbers and
report the f inal sum

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/3
Solution
}
}
if(count==0 && num!= 1)
printf(\"%d \",num);
}
printf(Palindrome numbers in given range are: );
for(n=min;n<=max;n++)
{
temp=n;
sum=0;
while(temp)
{
r=temp%10;
temp=temp/10;
sum=sum*10+r;
}
if(n==sum)
printf(%d ,n); }
count=0;
if(count==0 && n!= 1)

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/3

Sign up to view the full document!

lock_open Sign Up
Unformatted Attachment Preview
A palindromic prime is a prime number that, when reversed, maintains the same value. For example, 11 is a palindromic prime. Write a program that calculates and displays all of the 3 -digit palindromic primes between 100 - 999 and the sum of all the primes listed. You are expected to use a for-loop to iterate over all necessary values. Your program should simply display a single integer: the sum of all 3 -digit palindromic primes. Note: You are not allowed to use functions to solve this problem. ex. three digit prime, three digit prime, three digit prime, three digit prime, three digit prime, three digit prime, three digit prime, three digit prime, three digit prime, three digit prime, three digit prime, three digit prime, three digit prime, three digit prime, three digit prime, three digit prime, three digit prime, three digit prime, three digit prime, three digit prime, three digit pri ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.
Studypool
4.7
Indeed
4.5
Sitejabber
4.4

Similar Documents