diff --git a/Soru2.go b/Soru2.go new file mode 100644 index 0000000..72c4993 --- /dev/null +++ b/Soru2.go @@ -0,0 +1,18 @@ +package main + +import "fmt" + +func main() { + sonuc := 1 + var dizi [20]int + dizi[0] = 1 + dizi[1] = 2 + for i := 2; i <= 19; i++ { + sonuc = sonuc + dizi[i-1] + dizi[i] = sonuc + 1 + + } + + fmt.Println(dizi) + +} diff --git a/calisma03/soru1.go b/calisma03/soru1.go new file mode 100644 index 0000000..79d8c00 --- /dev/null +++ b/calisma03/soru1.go @@ -0,0 +1,46 @@ +package main + +import "fmt" + +func main() { + var A [10]int + var B [10]int + var C [10]int + for i := 0; i <= 9; i++ { + fmt.Println("Bir sayı giriniz") + fmt.Scanf("%d", &A[i]) + + } + for m := 0; m < len(A); m++ { + for n := 0; n < len(A)-1-m; n++ { + if A[n] > A[n+1] { + A[n], A[n+1] = A[n+1], A[n] + } + } + } + + fmt.Println(A) + + for j := 0; j <= 9; j++ { + fmt.Println("Bir sayı giriniz") + fmt.Scanf("%d", &B[j]) + + } + + for k := 0; k < len(B); k++ { + for l := 0; l < len(B)-1-k; l++ { + if B[l] < B[l+1] { + B[l], B[l+1] = B[l+1], B[l] + } + } + } + + fmt.Println(B) + for p := 0; p <= 9; p++ { + + C[p] = A[p] + B[p] + + } + fmt.Println(C) + +}