From 7a3d7a9ac1db388d4a9054de456cbf5dde7c1e07 Mon Sep 17 00:00:00 2001 From: Selin Kurt Date: Sun, 24 Mar 2019 18:44:34 +0300 Subject: [PATCH 1/2] Odev1 icin cozum eklendi --- calisma03/ODEV1.go | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 calisma03/ODEV1.go diff --git a/calisma03/ODEV1.go b/calisma03/ODEV1.go new file mode 100644 index 0000000..0db674c --- /dev/null +++ b/calisma03/ODEV1.go @@ -0,0 +1,50 @@ +package main + +import "fmt" + +func main() { + var A [10]int + var B [10]int + var C [10]int + + fmt.Println("Ilk dizinin 10 elemanini giriniz: ") + for i := 0; i < 10; i++ { + fmt.Scanf("%d", &A[i]) + } + + fmt.Println("ilk dizi:", A) + gecici := 0 + for i := 0; i < 9; i++ { + for j := i + 1; j < 10; j++ { + if A[i] < A[j] { + gecici = A[i] + A[i] = A[j] + A[j] = gecici + } + } + } + fmt.Println(A) + + fmt.Println("Ikinci dizinin 10 elemanini giriniz: ") + for j := 0; j < 10; j++ { + fmt.Scanf("%d", &B[j]) + } + fmt.Println("ikinci dizi:", B) + gecici = 0 + for i := 0; i < 9; i++ { + for j := i + 1; j < 10; j++ { + if B[i] > B[j] { + gecici = B[i] + B[i] = B[j] + B[j] = gecici + } + } + } + fmt.Println(B) + + for i := 0; i < 10; i++ { + C[i] = A[i] + B[i] + } + fmt.Println("C dizisi: ", C) + +} From 611e72e29d45d90c4373e072630f405729a051ff Mon Sep 17 00:00:00 2001 From: Selin Kurt Date: Sun, 24 Mar 2019 18:50:17 +0300 Subject: [PATCH 2/2] Odev2 icin cozum eklendi --- calisma03/ODEV2.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 calisma03/ODEV2.go diff --git a/calisma03/ODEV2.go b/calisma03/ODEV2.go new file mode 100644 index 0000000..e8e667d --- /dev/null +++ b/calisma03/ODEV2.go @@ -0,0 +1,21 @@ +//her elemani, kendinden onceki elemanlarin toplaminin 1 fazlasi olarak tanimlanmis dizi +package main + +import "fmt" + +func main() { + array := [20]int{ + 1, + 2, + } + + for i := 2; i < 20; i++ { + for j := 0; j < i; j++ { + array[i] += array[j] + } + array[i] += 1 + + } + fmt.Println(array) + +}