Computer Science, asked by debolina19dutta99, 10 months ago

Prime permutations
You are given a number N. Write a program to find all the arrangements of the natural numbers from 1 to N in which the indices (starting
from 1) of prime numbers are also prime numbers modulo 1000000007.
Input format
The first line contains N.
Output format
Print all the arrangements of the natural numbers from 1 to N in which the indices (starting from 1) of prime numbers are also prime
numbers.
Constraints
1<N< 10
Sample Output
&
Sample Input
%
12
Explanation
Permutations satisfying the above conditions are :
• 1,2,3,4,5
. 1,2,5,4,3
• 1,3,2,4,5
• 1,3,5,4,2
9
(
4
x
11:58 AM
ENG 30-03-2020
BP​

Answers

Answered by ranyodhmour892
0

Answer:

Cinclude <iostream>

using namespace std;

class gajjar

{

double a,b;

public:

void read()

{

cout<<"\nEnter two double type numbers:";

cin>>a>>b;

}

void div()

{

try{

if(cin.fail())

throw "Bad input!";

if( b == 0 )

throw 0;

cout<<"\nAns is "<<a/b;

}

catch(const int n)

{

cout << "\nDivision by " << n << " not allowed\n";

}

catch(const char* Str)

{

cout<< Str;

}

}

};

int main()

{

gajjar k;

k.read();

k.div();

return 0;

Answered by shrutisharma4567
3

REFER THIS ATTACHMENT GIVE ABOVE

REFER THIS ATTACHMENT GIVE ABOVEPLZ MARK IT AS BRAINLIEST!!!

Attachments:
Similar questions