36 lines
849 B
Python
36 lines
849 B
Python
# -*- coding: utf-8 -*-
|
|
"""MK-DAA-NATASYA-POETRI-HANYORO.ipynb
|
|
|
|
Automatically generated by Colab.
|
|
|
|
Original file is located at
|
|
https://colab.research.google.com/drive/1VxS3iwOQA8da5tDzBU4SBp8K2FfDag6f
|
|
|
|
PROGRAM FIZZBUZZ 1-100
|
|
|
|
*PROGRAM FIZZBUZZ MENGGUNAKAN C++
|
|
"""
|
|
|
|
# Commented out IPython magic to ensure Python compatibility.
|
|
# %%writefile fizzbuzz.cpp
|
|
# #include <iostream>
|
|
# #include <string>
|
|
#
|
|
# int main() {
|
|
# for (int i = 1; i <= 100; ++i) {
|
|
# std::string output = std::to_string(i);
|
|
# if (i % 3 == 0 && i % 5 == 0) {
|
|
# output += " FizzBuzz";
|
|
# } else if (i % 3 == 0) {
|
|
# output += " Fizz";
|
|
# } else if (i % 5 == 0) {
|
|
# output += " Buzz";
|
|
# }
|
|
# std::cout << output << std::endl;
|
|
# }
|
|
# return 0;
|
|
# }
|
|
|
|
!g++ fizzbuzz.cpp -o fizzbuzz
|
|
|
|
!./fizzbuzz |