Quick actions

cmd+k|ctrl+k

Navigation

Languages

Algoritma3.2

Snippet info

Language

Cpp

Visibility

public

Author

mikoshiba27

Created

2024-10-26T09:02:56.139612Z

Updated

2024-10-26T09:03:01.825368Z

#include <iostream>
using namespace std;

int main() {
    puts("=================================");
    puts(" Contoh Operator Perbandingan");
    puts("=================================");

    float a, b, c, d;
    int x = 8, y = 4;

    cout << "Nilai x adalah = " << x << endl;
    cout << "Nilai y adalah = " << y << endl;

    /* Bernilai Sama Dengan */
    a = (x == y);

    /* Bernilai Tidak Sama Dengan */
    b = (x != y);

    /* Bernilai Lebih Besar Dari */
    c = (x > y);

    /* Bernilai Lebih Kecil Dari */
    d = (x < y);

    puts("=================================");
    cout << "Hasil dari x == y adalah " << a << endl;
    cout << "Hasil dari x != y adalah " << b << endl;
    cout << "Hasil dari x > y adalah  " << c << endl;
    cout << "Hasil dari x < y adalah  " << d << endl;
    puts("=================================");

    return 0;
}
INFO