Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odev1 icin cozum eklendi #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions calisma03/ODEV1.go
Original file line number Diff line number Diff line change
@@ -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)

}
21 changes: 21 additions & 0 deletions calisma03/ODEV2.go
Original file line number Diff line number Diff line change
@@ -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)

}