Skip to content

Instantly share code, notes, and snippets.

View eroltutumlu's full-sized avatar

Erol TUTUMLU eroltutumlu

View GitHub Profile
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
enum { NOUGHTS, CROSSES, BORDER, EMPTY };
enum { HUMANWIN, COMPWIN, DRAW };
const int Directions[4] = { 1, 5, 4, 6 };
const int ConvertTo25[9] = {
@eroltutumlu
eroltutumlu / gist:9a454b30d976dac306b4
Created February 8, 2015 18:50
Pointer ile struct'a bağlanma
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Structure declaration */
struct personCatalog {
char name[50];
char address[50];
char cityState[50];
char zipCode[7];
@eroltutumlu
eroltutumlu / gist:8172f85b0fb542d90a81
Created February 8, 2015 12:06
Lattice paths // Project Euler 15
#include <stdio.h>
#define SIZE 20
//http://www.robertdickau.com/lattices.html must be known for solution.
int main(void) {
int i,j;
long long int grid[SIZE+1][SIZE+1];
long long sum = 0;
for(i=0;i<SIZE;i++)
@eroltutumlu
eroltutumlu / gist:c0bd63a6e2c42757278c
Last active August 29, 2015 14:14
Project Euler 52 // Permuted multiples
//https://projecteuler.net/problem=52
#include <stdio.h>
enum boolean{false,true};
typedef enum boolean bool;
int main(void) {
int isFound = false ;
int index = 100002;
int two_multiplier;
int three_multiplier;
int four_multiplier;
@eroltutumlu
eroltutumlu / gist:02b761ddf55e71ea3e0d
Created February 4, 2015 12:33
Largest product in a series
// https://projecteuler.net/problem=8
#include <stdio.h>
#include <string.h>
#define MAX_DIGIT 13
#define NUM 1000
int main(void) {
char num[NUM+1];
@eroltutumlu
eroltutumlu / gist:721504e2d24fa798972e
Last active August 29, 2015 14:14
Recursive Func. Examples
//Bir sayının tersini özyinemeli olarak alıyor.
// Fibonacci serisi ve faktöriyel örnekleride özyinemeli olarak daha rahat çözülebilir.
#include <stdio.h>
#include <math.h>
int main(void)
{
int number;
int length=0;
printf("Number: ");
scanf("%d",&number);
@eroltutumlu
eroltutumlu / gist:d38f8c07440fa5ac3524
Last active August 29, 2015 14:14
Sıralama Algoritmaları
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int loopIndex;
int loopIndex2;
void ShowSort(int,int[]);
void BubbleSort(int, int[]);
void InsertionSort(int,int *);
@eroltutumlu
eroltutumlu / gist:521a4f96187a98f2208c
Created January 31, 2015 19:53
Smith Sayılarını Listeleyen Program
/*
Smith Sayısı nedir?
1 den büyük asal olmayan bir tamsayının rakamlarının toplamı, sayı asal çarpanlarına ayrılarak yazıldığında bu yazılışta bulunan tüm asal sayıların rakamlarının toplamına eşit oluyorsa bu tür sayılara Smith sayısı denir.
Örneğin:
728 = 2 * 2 * 2 * 7 * 13
7 + 2 + 8 = 2 + 2 + 2 + 7 + 1 + 3
*/
@eroltutumlu
eroltutumlu / gist:0bcbf33041af94ef1a62
Created January 31, 2015 19:51
Binary Search Algorithm
#include <stdio.h>
#include <stdlib.h>
#define SIZE 10
#define SORTED 1
#define UNSORTED 0
int main(void) {
int i,j;
int Arr[SIZE]={10,2,6,9,-8,3,2,4,5,8};
@eroltutumlu
eroltutumlu / gist:d66c8939627457f42b30
Last active August 29, 2015 14:12
Struct kullanımına ufak bir örnek
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZE 2
enum boolean{
false=0,
true
}isTrue;
typedef enum boolean bool;