forked from mehtimsv/ApLabGitPractice
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1.cpp
More file actions
62 lines (52 loc) · 1003 Bytes
/
1.cpp
File metadata and controls
62 lines (52 loc) · 1003 Bytes
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <iostream>
#include <string>
#include <math.h>
#include<cassert>
using namespace std;
//long long int* m;
void test_factorial();
long long int factorial(int n)
{
return (n == 1 || n == 0) ? 1 : factorial(n - 1) * n;
}
long long int* producingTheFactorialFractions()
{
long long int b[10] = { 0 };
//int i = 10
long long int m;
for (int i = 9; i >= 0; i--)
{ //(int)
m = (long long int)pow(factorial(10), 2.0);
b[i] += (long long int)pow(factorial(10), 2.0) / (i + 1);
}
return b;
}
void checkZeros(long long int a[10])
{
for (int i = 9; i >= 0; i--)
{ //a[i] = 0
if (a[0] == 0)
cout << "Zero Found" << endl;
}
}
int main()
{
long long int* a;
//
a = new long long int[10];
a = producingTheFactorialFractions();
long long int a2[10];
for (int i = 0; i < 10; i++)
a2[i] = a[i];
checkZeros(a2);
for (int i = 0; i < 10; i++)
{
cout << a2[i] << endl;
}
//delete[] a;
}
void test_factorial()
{
long long int a = factorial(10);
assert(a == 3628800);
}