-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a0fb56a
commit 23b7425
Showing
5 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
C syntax | Go syntax | ||
------------ | ------------- | ||
int x; | x: int , x int | ||
int *p; | p: pointer to int , p *int | ||
int a[3]; | a: array[3] of int , a [3]int | ||
int main(int argc, char *argv[]) { /* ... */ } | func main(argc int, argv []string) int | ||
int main(int, char *[]) | func main(int, []string) int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package main | ||
|
||
import "fmt" | ||
|
||
func add(x int, y int) int { | ||
return x + y | ||
} | ||
|
||
func sub(x int, y int) int { | ||
return x-y | ||
} | ||
|
||
func mult(x int, y int) int { | ||
return x*y | ||
} | ||
|
||
func bolme(x int, y int) int { | ||
return x/y | ||
} | ||
|
||
func kalan(x int, y int) int { | ||
return x%y | ||
} | ||
|
||
|
||
func main() { | ||
fmt.Println(add(42,42)) //84 | ||
fmt.Println(sub(42,12)) //30 | ||
fmt.Println(sub(12,42)) //-30 | ||
fmt.Println(mult(5,100)) //500 | ||
fmt.Println(bolme(100,5)) //20 | ||
fmt.Println(bolme(5,100)) //0 | ||
fmt.Println(kalan(102,5)) //2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package main | ||
|
||
import "fmt" //Fmt, biçimlendirme ve çıktıya ilişkin çeşitli işlevleri içeren bir paketin adıdır. | ||
|
||
func main() { | ||
fmt.Println("Hello World'suz baslangıc olmaz!") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"math" | ||
"math/rand" | ||
) | ||
|
||
func main(){ | ||
fmt.Println("Rastgele bir sayi: ", rand.Intn(20)) | ||
fmt.Printf("Karekok: %g ", math.Sqrt(4)) | ||
fmt.Println("Pi sayisi: ",math.Pi) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
) | ||
|
||
func main() { | ||
fmt.Println("Saat: ", time.Now()) | ||
} |