TI

Pertanyaan

buatlah contoh program c++ yang hasil outputnya saya suka belajar program c++

2 Jawaban

  • #include <iostream>
    using namespace std;

    int main()
    {
    cout << "saya suka belajar program c++";
    }
  • Contoh program c++:

    Membuat pyramid dengan simbol *

    code:
    #include <iostream>
    using namespace std;

    int main() {
    int rows;
    cout << "Tentukan jumlah baris pyramid: ";
    cin >> rows;
    for(int i = 1; i <= rows; ++i) {
    for(int j = 1; j <= i; ++j) {
    cout << "* ";
    }
    cout << "\n";
    }
    return 0;
    }

Pertanyaan Lainnya