Share the Assignment Questions & Discuss Here....
Stay touched with this discussion, Solution idea will be uploaded as soon as possible in replies here before the due date.
Share the Assignment Questions & Discuss Here....
Stay touched with this discussion, Solution idea will be uploaded as soon as possible in replies here before the due date.
cs508 assignment no 03 solution fall 2020
import java.io.*;
import java.math.*;
import java.util.scanner;
class TwistedPrimeNumber {
static int reverse(int num){
int rev = 0, remainder;
while(num > 0) {
remainder = num %10;
rev = rev * 10 +remainder;
num = num/10;
}
return rev;
}
static boolean isPrime(intnum) {
int flage = 0;
for (int i = num; i >= 1; i--){
if(num % i == 0){
flage += 1;
}
}
if(flage == 2) {
return true;
}
else{
return false;
}
}
static boolean isTwistedPrime (int num){
if(isPrime (num) == false){
return false;
}
else {
return isPrime(reverse (num));
}
}
public static void main(String args[]) {
scanner scan = new scanner (system.in);
String uid;
system.out.print("Enter Your Vu ID");
uid = scan.nextLine();
String id = uid.substrings(7,11);
stringBuilder rid = new stringBuilder(id);
rid.reverse() ;
int count = Integer.parseInt(rid.tostring());
for(int i = 2; i <= count; i++){
if(isTwistedPrime(i)) {
system.out.print(i + " ");
}
}
}
}
https://drive.google.com/file/d/1j47i1lCVsYJbIRa92e9PQtfpEf-31Y_r/v...
2 line miss hai is mn bhi :X
© 2021 Created by + M.Tariq Malik.
Powered by
Promote Us | Report an Issue | Privacy Policy | Terms of Service
We are user-generated contents site. All product, videos, pictures & others contents on site don't seem to be beneath our Copyrights & belong to their respected owners & freely available on public domains. We believe in Our Policy & do according to them. If Any content is offensive in your Copyrights then please email at m.tariqmalik@gmail.com with copyright detail & We will happy to remove it immediately.
Management: Admins ::: Moderators
Awards Badges List | Moderators Group
All Members | Featured Members | Top Reputation Members | Angels Members | Intellectual Members | Criteria for Selection
Become a Team Member | Safety Guidelines for New | Site FAQ & Rules | Safety Matters | Online Safety | Rules For Blog Post