Created
March 5, 2019 06:43
-
-
Save mufti1/2dfeda50231d4c7d335c3e01c64a5f16 to your computer and use it in GitHub Desktop.
Get Prime Number and count it
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
package main | |
import ( | |
"fmt" | |
) | |
func main() { | |
var a, b, c int | |
fmt.Scanf("%v", &a) | |
for i := 1; i <= a; i++ { | |
b = 0 | |
if c >= a { | |
c = c - i | |
break | |
} | |
for j := 1; j <= i; j++ { | |
if (i % j) == 0 { | |
b = b + 1 | |
} | |
} | |
if b <= 2 { | |
c = c + i | |
} | |
} | |
fmt.Println(c) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment