diff --git a/mk_daa_rasya_alfahrizi.py b/mk_daa_rasya_alfahrizi.py new file mode 100644 index 0000000..ffb1f8b --- /dev/null +++ b/mk_daa_rasya_alfahrizi.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +"""MK-DAA-Rasya-Alfahrizi.ipynb + +Automatically generated by Colab. + +Original file is located at + https://colab.research.google.com/drive/1VhjxRGwEACSu603yf4vSszy0Ii6hNzex + +**PROGRAM FIZZBUZZ 1-100** + +~ *Program FizzBuzz menggunakan c++* +""" + +# Commented out IPython magic to ensure Python compatibility. +# %%bash +# cat << 'EOF' > fizzbuzz.cpp +# #include +# using namespace std; +# +# int main() { +# for(int i = 1; i <= 100; i++) { +# if(i % 3 == 0 && i % 5 == 0) { +# cout << i << " FizzBuzz" << endl; +# } +# else if(i % 3 == 0) { +# cout << i << " Fizz" << endl; +# } +# else if(i % 5 == 0) { +# cout << i << " Buzz" << endl; +# } +# else { +# cout << i << endl; +# } +# } +# return 0; +# } +# EOF +# +# g++ fizzbuzz.cpp -o fizzbuzz +# ./fizzbuzz + +"""~ *Program FizzBuzz menggunakan Python*""" + +for i in range(1, 101): + if i % 3 == 0 and i % 5 == 0: + print(i, "FizzBuzz") + elif i % 3 == 0: + print(i, "Fizz") + elif i % 5 == 0: + print(i, "Buzz") + else: + print(i) \ No newline at end of file