## CS508 Assignment 3 Solution 2021

In This Post, I’ve CS508 Assignment 3 Solution 2021.

Download CS508 Assignment Solution File From Here. Download Moaaz past papers and Waqar’s past papers from our website. You can Download all assignment solutions from our website.
# Join Our Social Media Groups

We Are Here To Supply Latest Virtual University Solutions. Assignment Solutions, GDB Solution, Quiz Solution Viva Solution Midterm Past Papers, and Final term Past Papers.

Problem Statement:

A number is said to be twisted prime if it is a prime number and reverse of this number is also a prime number. For example, “97” is a twisted prime number as “97” is a prime number and its reverse “79” is also a prime number.

You are required to write a Java program which will print all twisted prime numbers between 1 and last 4 digits (in reverse order) of your student id. If your student id is BS123456789 then print all twisted prime numbers between 1 and 9876.

- You need to take student Id as input from user.
- Print student Id on top of the console screen.
- Take last 4 digits from student Id and reverse them.
- Then run a loop which should execute according to reverse value of last 4 digits (e.g., 9876 times).
- During each iteration, check whether it is a prime number or not.
- If it is a prime number, then reverse it.
- Now check the reversed number, is it also prime or not?
- If it is also a prime number, then just print the original number on console.