forked from mehtimsv/ApLabGitPractice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1.cpp
47 lines (39 loc) · 687 Bytes
/
1.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>
#include <string>
#include <math.h>
using namespace std;
long long *b;
long long int factorial(int n)
{
return (n == 1 || n == 0) ? 1 : factorial(n - 1) * n;
}
long long int *producingTheFactorialFractions()
{
b = new long long[10];
for (int i = 9; i >= 0; i--)
{
b[i] += (long long int)pow(factorial(10), 2.0) / (i + 1);
}
return b;
}
void checkZeros(long long *a)
{
for (int i = 9; i >= 0; i--)
{
if (a[i] == 0)
cout << "Zero Found" << endl;
}
}
int main()
{
long long int *a;
a = producingTheFactorialFractions();
checkZeros(a);
for (int i = 0; i < 10; i++)
{
cout << a[i] << endl;
}
delete a;
cout << "hello\n";
cout << "Bye";
}