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
def sieve_of_eratosthenes(limit): | |
print("Masukkan batas bilangan yang diuji:") | |
if limit < 2: | |
return [] | |
# Step 6: Coret angka 0 dan 1 | |
bilangan = [True] * (limit + 1) | |
bilangan[0] = bilangan[1] = False | |
# Step 8: Mulai dari p = 2 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 <iostream> | |
using namespace std; | |
int power(int number, int pow) { | |
if (pow == 0){ | |
return 1; | |
} | |
return number * power(number, pow-1); | |
} |
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 <iostream> | |
using namespace std; | |
int main() { | |
int hasil = 1; | |
int angka = 3; | |
int pangkat = 3; | |
for (int i = 1; i <= pangkat; i++) { |
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
# Muhammad Khuirul Huda | |
umur = int(input("Masukkan Umur Anda: ")) | |
jenisKelamin = input("Masukkan Jenis Kelamin Anda: ") | |
hasilTes1 = float(input("Hasil Tes 1: ")) | |
hasilTes2 = float(input("Hasil Tes 2: ")) | |
kolomC = 0 | |
kolomE = 0 |
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 <iostream> | |
using namespace std; | |
int main() | |
{ | |
int umur; | |
string jenisKelamin; |
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 <iostream> | |
using namespace std; | |
bool isPrima(int number) { | |
if (number <= 1 ) { | |
return false; | |
} | |
for (int i = 2; i < number; i++) { | |
if ((number % i) == 0) { |
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 <iostream> | |
using namespace std; | |
// fungsi untuk menentukan apakah input bilangan prima atau tidak... fungsi ini mereturn boolean benar atau salah | |
bool isPrima(int number) { | |
int prima = true; | |
// karena bilangan prima adalah bilangan yang habis dibagi 1 dan bilangan itu sendiri maka dibuat perulangan untuk mengecek tiap angka apakah bisa habis membagi bilangan yang diberikan | |
if (number <= 0 || number == 1) { | |
return false; | |
} |
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
//don't run | |
#include<stdio.h> | |
#include<iostream> | |
using namespace std; | |
int main() | |
{ | |
int dat[2][5] = {{1, 2, 3, 4, 5}, | |
{7, 9, 0, 2, 4}}; |
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> | |
#include<time.h> | |
#include<stdlib.h> | |
void generateTicket() { | |
int i; | |
char random[26]="abcdefghijklmnopqrstuvwxyz"; | |
char tiket[8]; | |
for (i = 0; i < 8; ++i) { | |
tiket[i] = random[rand() % (sizeof(random) - 1)]; |
NewerOlder