https://github.com/robbypambudi/general_programming_in_c
This is my programing project with C Language to solve any problem on internet
https://github.com/robbypambudi/general_programming_in_c
c project
Last synced: 2 months ago
JSON representation
This is my programing project with C Language to solve any problem on internet
- Host: GitHub
- URL: https://github.com/robbypambudi/general_programming_in_c
- Owner: robbypambudi
- Created: 2021-10-19T19:14:34.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-10-20T06:18:54.000Z (over 3 years ago)
- Last Synced: 2025-02-01T19:22:58.675Z (4 months ago)
- Topics: c, project
- Language: C
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Catatan Istimewa
## Modulo
Sifat-sifat tersebut dapat dimanfaatkan untuk mempermudah perhitungan modulo. Sebagai contoh, Anda diberikan bilangan n dan k, lalu diminta menghitung hasil n! mod k. Pada contoh ini, n! Seandainya kita menghitung n! terlebih dahulu, kemudian baru dimodulo k, kemungkinan besar kita akan mendapatkan integer overflow. Ingat bahwa n! dapat bernilai sangat besar dan tidak dapat direpresentasikan dengan tipe data primitif integer.
- (a + b) mod m = ((a mod m) + (b mod m)) mod m
- (a - b) mod m = ((a mod m) - (b mod m)) mod m
- (a * b) mod m = ((a mod m) * (b mod m)) mod m
- a^b mod m = (a mod m)^b mod m
- (-a) mod m = (-(a mod m) + m) mod m### 1. Menentukan Ganjil Genap
- Dengan di modulo 2 akan menghasilkan 0 jika genap
- 1 jika ganjil
-
---
### 2. Menentukan Faktorisasi Prima---
### 3. Membuat Bilangan Prima dengan mengimplementasikan Algoritma Sieve Of EratostSumber :
- https://id.wikipedia.org/wiki/Tapis_Eratosthenes
---### 4. Menentukan FPB dengan Algoritma Euclid
Sumber :
- https://id.wikipedia.org/wiki/Algoritme_Euklides
---### 5. Fibonaci Series
<<<<<<< HEAD
- With recursive
```
Function (int N)
{
static int N1 = 0, N2 = 1, N3;if (N > 0)
{
N3 = N1 + N2;
N1 = N2;
N2 = N3;
printf("%d ", N3);
fibonaci(N - 1);
}
}
```
- Without recursive
```
for (int i = 2; i < N; ++i)
{
N3 = N1 + N2;
printf("%d ", N3);
N1 = N2;
N2 = N3;
}
```
**What is Static Int ?**
https://www.geeksforgeeks.org/static-variables-in-c/### Factorial
- Factorial Using Loop
```
for (int i = N; i > 0; i--)
{
Fact *= i;
}
```
Output
```
Enter Number : 5
5 4 3 2 1
Factorial is : 120
```- Factorial Using Recursive
```
Function factorial(int number)
{
if (number == 1)
return 1;
else
{
return (number * (factorial(number - 1)));
}
}
```
Ouput
```
nter The Number : 6
Resault Is : 720
```
---
### Amstrong Number
What is Amstrong Number ?
```
153 = (1*1*1) + (5*5*5) + (1*1*1)
153 = 153Is Amstrong Number
```
---
### Number Triangel
```
Enter The Range : 5
1
121
12321
1234321
123454321
```