Last active
November 15, 2021 06:43
-
-
Save defrindr/2db750ca24f7ca26926032b4e2d08671 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#include <stdio.h> | |
int main() | |
{ | |
int bilangan,dibagi_sebanyak; | |
printf("Masukan bilangan : "); | |
scanf("%d", &bilangan); | |
dibagi_sebanyak = 0; | |
for(int i=1;i<=bilangan;i++){ | |
if(bilangan % i == 0){ | |
dibagi_sebanyak++; | |
} | |
} | |
if(dibagi_sebanyak == 2){ | |
printf("Bilangan prima"); | |
}else{ | |
printf("Bukan bilangan prima"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment