CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
Solution to the Fisher number challenge
Input 1 number to check if it is a fisher number
Input 2 numbers separated by a space to output all the fusher numbers in that range
*/
#include <iostream>
using namespace std;
bool isFisher(int a){
int prod=1;
for(int i=1; i<=a/2; i++)
if(a%i==0)
prod*=i;
if(prod==a*a)
return 1;
return 0;
}
int main() {
int a, b=-123456789;
cin>>a>>b;
//cout<<a<<" "<<b;
if(b==-123456789){
if(isFisher(a))
cout<<a<<" is a Fisher number"<<endl;
else
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run