Computer Science, asked by saqlain111, 1 year ago

WAP to find Primorial of a number In Java​

Answers

Answered by prabhhere
21

import java.util.*;

public class Primorial

{

public static void main(String args[])

{

Scanner ob=new Scanner(System.in);

System.out.println("Enter the number whose primorial is to be printed.");

int num=ob.nextInt();

long fact=1;

for(int i=num;i>1;i--)

{

int c=0;

for(int j=1;j<=i;j++)

{

if(i%j==0)

{

c++;

}

}

if(c==2)

{

fact=fact*i;

}

}

System.out.println("Primorial of "+num+" is "+fact);

}

}

Please mark as BRAINLIEST! Good Luck :))

Answered by rupesh4726
5

Answer:

Explanation:

This program finds the Primorial of a given number.A primorial is also known as P-prime factorial.As factorial a Primorial is the product of all the prime numbers which are present from number till 1.It is denoted as P# of a number. Example- Primorial of 10 is 10#=7*5*3*2=210.

Similar questions