Skip to content

Instantly share code, notes, and snippets.

View eroltutumlu's full-sized avatar

Erol TUTUMLU eroltutumlu

View GitHub Profile
@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];
#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:d1c1eb66183b996bfaad
Created February 10, 2015 20:48
Sieve of Eratosthenes Algorithm
#include <stdio.h>
#include <stdlib.h>
#define SIZE 1000000
int main(void) {
long long int i,j;
int *primes;
primes = malloc(sizeof(int)*SIZE);
@eroltutumlu
eroltutumlu / gist:2997e27bdd505f200b86
Created February 11, 2015 12:58
Öklid Algoritması ile Ebob bulma
#include <stdio.h>
/*
ebob(m, n) = ebob(n, m mod n)
while n != 0
rm mod n
mn
nr
return m
package Sample;
public class Main {
public static void main(String[] args) {
Divide exp = new Divide();
int Sonuc = exp.Divider(10, 5);
@eroltutumlu
eroltutumlu / gist:88a4e6d08fc02e7ddc7c
Last active August 29, 2015 14:15
Lychrel number
/*
NOT: Algoritma doğru fakat Big Integer sınıfı kullanılmadığı için değer aşımı var .
https://projecteuler.net/problem=55
Eğer 47 sayısını alır ters çevirir ve toplarsak 47+74 = 121 sayısını elde ederiz ki bu sayı palindromik bir sayıdır(sağdan ve soldan yazıldığında aynı).
Fakat her sayı bu kadar kolay palindrom üretmez. Örneğin:
@eroltutumlu
eroltutumlu / gist:0626ee1bff7426efbc9e
Created February 27, 2015 17:39
Java ile sayı tahmin
package JavaOgreniyorum;
import java.util.*;
public class Main {
public static void main(String[] args) {
Random rand = new Random();
final int randomNumber = rand.nextInt(100)+1;
int GuessNumber;
@eroltutumlu
eroltutumlu / gist:a81232e8736d9d3f0655
Created February 28, 2015 11:10
Simple TicTacToe Game | JAVA
package JavaOgreniyorum;
// Main class'ından obje oluşturulup çağırılmalıdır.
import java.util.Scanner;
public class XOXGame {
private final int cSIZE = 3;
private final int rSIZE = 3;
@eroltutumlu
eroltutumlu / gist:1bdffbd86174de99001a
Created March 4, 2015 21:30
Simple java Collections sample
import java.util.*;
public class Main {
public static void main(String[] args) {
List<String> list1 = new ArrayList<String>();
Scanner scan = new Scanner(System.in);
System.out.println("Bir sayı yazınız : ");
int number = scan.nextInt();
@eroltutumlu
eroltutumlu / gist:eeccb358b2d4d73db820
Last active August 29, 2015 14:16
Singly Linked Lists in C
#include <stdio.h>
#include <stdlib.h>
struct listNode{
int id;
char name[10];
struct listNode *nextPtr;
};
typedef struct listNode ListNode;