Skip to content

Instantly share code, notes, and snippets.

View sujimodern's full-sized avatar

Suji sujimodern

View GitHub Profile
@sujimodern
sujimodern / example_of_c.c
Last active July 9, 2019 13:32
An example of a C program
/* -*- mode: C -*- */
#include <stdlib.h>
#include <stdio.h>
/* プログラムの本体 */
int main(void) {
// 宣言
double A[5] = {
[0] = 9.0,
[1] = 2.9,
@sujimodern
sujimodern / fermat.c
Last active July 7, 2019 01:40
Fermat's little theorem
#include <stdio.h>
int power_mod(int b, int e, int m) {
int r = 1;
for (int i = 0; i < e; ++i) {
r = (r * b) % m;
}
return r;
}
@sujimodern
sujimodern / euclidean_algorithm.c
Last active July 6, 2019 05:49
Euclidean algorithm in c
#include <stdio.h>
int gcd(int a, int b) {
int r;
for (;;) {
r = a % b;
if (!r)
break;
a = b;
b = r;