Skip to content

Commit 2d37670

Browse files
Ramanpreet6262MadhavBahl
authored andcommitted
Added implementation of fizzbuzz in go (#14)
* Add @Ramanpreet6262 as a contributor * added fizzbuzz implementation in go * Update CONTRIBUTORS.md
1 parent a0207ab commit 2d37670

File tree

5 files changed

+233
-148
lines changed

5 files changed

+233
-148
lines changed

.all-contributorsrc

+10
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@
6363
"code"
6464
]
6565
},
66+
{
67+
"login": "Ramanpreet6262",
68+
"name": "Ramanpreet Singh",
69+
"avatar_url": "https://avatars2.githubusercontent.com/u/28749866?v=4",
70+
"profile": "https://github.com/Ramanpreet6262",
71+
"contributions": [
72+
"doc",
73+
"code"
74+
]
75+
}
6676
{
6777
"login": "imkaka",
6878
"name": "Anil Khatri",

CONTRIBUTORS.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11

2-
[![All Contributors](https://img.shields.io/badge/all_contributors-6-orange.svg?style=flat-square)](#contributors)
2+
[![All Contributors](https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat-square)](#contributors)
33
## Contributors
44

55
Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
66

77
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
88
<!-- prettier-ignore -->
9-
| [<img src="https://avatars2.githubusercontent.com/u/26179770?v=4" width="100px;"/><br /><sub><b>MADHAV BAHL</b></sub>](http://madhavbahl.tech/)<br />[💻](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=MadhavBahlMD "Code") [📝](#blog-MadhavBahlMD "Blogposts") [📖](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=MadhavBahlMD "Documentation") [🎨](#design-MadhavBahlMD "Design") [✅](#tutorial-MadhavBahlMD "Tutorials") | [<img src="https://avatars2.githubusercontent.com/u/32531173?v=4" width="100px;"/><br /><sub><b>Rajdeep Roy Chowdhury</b></sub>](http://www.linkedin.com/in/razdeeproychowdhury)<br />[💻](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=Razdeep "Code") [📖](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=Razdeep "Documentation") [✅](#tutorial-Razdeep "Tutorials") | [<img src="https://avatars1.githubusercontent.com/u/16208722?v=4" width="100px;"/><br /><sub><b>Hrishi</b></sub>](https://hrishi1999.github.io)<br />[📖](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=Hrishi1999 "Documentation") [💻](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=Hrishi1999 "Code") | [<img src="https://avatars1.githubusercontent.com/u/33101287?v=4" width="100px;"/><br /><sub><b>Bhanu Ailani</b></sub>](https://github.com/Bhanu0202)<br />[📖](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=Bhanu0202 "Documentation") [💻](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=Bhanu0202 "Code") | [<img src="https://avatars3.githubusercontent.com/u/35690440?v=4" width="100px;"/><br /><sub><b>Deepak Sharma</b></sub>](https://sourcerer.io/dsdsharma)<br />[📖](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=dsdsharma "Documentation") [💻](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=dsdsharma "Code") | [<img src="https://avatars1.githubusercontent.com/u/27620628?v=4" width="100px;"/><br /><sub><b>Anil Khatri</b></sub>](https://imkaka.github.io/)<br />[📖](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=imkaka "Documentation") [💻](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=imkaka "Code") |
10-
| :---: | :---: | :---: | :---: | :---: | :---: |
9+
10+
| [<img src="https://avatars2.githubusercontent.com/u/26179770?v=4" width="100px;"/><br /><sub><b>MADHAV BAHL</b></sub>](http://madhavbahl.tech/)<br />[💻](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=MadhavBahlMD "Code") [📝](#blog-MadhavBahlMD "Blogposts") [📖](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=MadhavBahlMD "Documentation") [🎨](#design-MadhavBahlMD "Design") [✅](#tutorial-MadhavBahlMD "Tutorials") | [<img src="https://avatars2.githubusercontent.com/u/32531173?v=4" width="100px;"/><br /><sub><b>Rajdeep Roy Chowdhury</b></sub>](http://www.linkedin.com/in/razdeeproychowdhury)<br />[💻](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=Razdeep "Code") [📖](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=Razdeep "Documentation") [✅](#tutorial-Razdeep "Tutorials") | [<img src="https://avatars1.githubusercontent.com/u/16208722?v=4" width="100px;"/><br /><sub><b>Hrishi</b></sub>](https://hrishi1999.github.io)<br />[📖](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=Hrishi1999 "Documentation") [💻](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=Hrishi1999 "Code") | [<img src="https://avatars1.githubusercontent.com/u/33101287?v=4" width="100px;"/><br /><sub><b>Bhanu Ailani</b></sub>](https://github.com/Bhanu0202)<br />[📖](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=Bhanu0202 "Documentation") [💻](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=Bhanu0202 "Code") | [<img src="https://avatars3.githubusercontent.com/u/35690440?v=4" width="100px;"/><br /><sub><b>Deepak Sharma</b></sub>](https://sourcerer.io/dsdsharma)<br />[📖](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=dsdsharma "Documentation") [💻](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=dsdsharma "Code") | [<img src="https://avatars1.githubusercontent.com/u/27620628?v=4" width="100px;"/><br /><sub><b>Anil Khatri</b></sub>](https://imkaka.github.io/)<br />[📖](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=imkaka "Documentation") [💻](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=imkaka "Code") | [<img src="https://avatars2.githubusercontent.com/u/28749866?v=4" width="100px;"/><br /><sub><b>Ramanpreet Singh</b></sub>](https://github.com/Ramanpreet6262)<br />[📖](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=Ramanpreet6262 "Documentation") [💻](https://github.com/MadhavBahlMD/DailyCodeBase/commits?author=Ramanpreet6262 "Code") |
11+
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
12+
1113
<!-- ALL-CONTRIBUTORS-LIST:END -->
1214

13-
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!
15+
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!

Day1/Go/FizzBuzz.go

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* @author: Ramanpreet Singh <[email protected]>
3+
* @github: https://github.com/Ramanpreet6262
4+
* @date: 20/12/2018
5+
*/
6+
7+
8+
package main
9+
10+
import "fmt"
11+
12+
func main() {
13+
fmt.Println("Enter a number upto which you want to find Fizzbuzz numbers: ")
14+
var n int
15+
_, err := fmt.Scanf("%d", &n)
16+
17+
if err != nil {
18+
fmt.Println(err)
19+
}
20+
21+
22+
for i := 1; i <= n; i++ {
23+
if i % 3 == 0 && i % 5 == 0 {
24+
fmt.Println("FizzBuzz")
25+
} else if i % 5 == 0 {
26+
fmt.Println("Buzz")
27+
} else if i % 3 == 0 {
28+
fmt.Println("Fizz")
29+
} else {
30+
fmt.Println(i)
31+
}
32+
}
33+
}

Day1/README.md

+40
Original file line numberDiff line numberDiff line change
@@ -244,3 +244,43 @@ public class FizzBuzz{
244244
}
245245

246246
```
247+
248+
## Go Implementation
249+
250+
### [FizzBuzz.go](./Go/FizzBuzz.go)
251+
252+
```go
253+
/*
254+
* @author: Ramanpreet Singh <[email protected]>
255+
* @github: https://github.com/Ramanpreet6262
256+
* @date: 20/12/2018
257+
*/
258+
259+
260+
package main
261+
262+
import "fmt"
263+
264+
func main() {
265+
fmt.Println("Enter a number upto which you want to find Fizzbuzz numbers: ")
266+
var n int
267+
_, err := fmt.Scanf("%d", &n)
268+
269+
if err != nil {
270+
fmt.Println(err)
271+
}
272+
273+
274+
for i := 1; i <= n; i++ {
275+
if i % 3 == 0 && i % 5 == 0 {
276+
fmt.Println("FizzBuzz")
277+
} else if i % 5 == 0 {
278+
fmt.Println("Buzz")
279+
} else if i % 3 == 0 {
280+
fmt.Println("Fizz")
281+
} else {
282+
fmt.Println(i)
283+
}
284+
}
285+
}
286+
```

0 commit comments

Comments
 (0)