Skip to content

Instantly share code, notes, and snippets.

View efeciftci's full-sized avatar

Efe Çiftci efeciftci

View GitHub Profile
@efeciftci
efeciftci / sieve_of_eratosthenes.c
Last active December 13, 2023 10:28
Animated Sieve of Eratosthenes prime number finder program in C.
// Sieve of Eratosthenes:
// https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
#include <stdio.h>
#include <stdlib.h>
// https://github.com/tapio/rlutil
#include "rlutil.h"
int N, *numbers, nrOfDigits;
@efeciftci
efeciftci / lns.py
Last active December 12, 2023 17:20
look and say sequence in python
#!/usr/bin/python3
# Look-and-say sequence: https://en.wikipedia.org/wiki/Look-and-say_sequence
num = int(input("Enter nth term: "))
i = 0
while i < num:
if i == 0:
series = [1]
else:
@efeciftci
efeciftci / strtok_example.c
Last active October 25, 2021 04:28
An example that shows usage of strtok function in C programming language.
/*
* The following description is from Linux Programmer's Manual (strtok(3)):
*
* #include <string.h>
* char *strtok(char *str, const char *delim);
*
* The strtok() function breaks a string into a sequence of zero or more
* nonempty tokens. On the first call to strtok() the string to be parsed
* should be specified in str. In each subsequent call that should parse
* the same string, str must be NULL.