Kamis, 17 Maret 2016

Contoh penggunaan if else


#include <iostream>
//CONTOH PENGGUNAAN IF ELSE//
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
    int number;
    cout<<"Masukkan number : ";
    cin>>number;
    if (number > 0)
    cout << "The number is positive." << endl;

else
    cout << "The number is not positive." << endl;

    return 0;
}


Output :
Apabila bilangan yang di inputkan positif :
Apabila bilangan yang di inputkan negatif :

Tidak ada komentar:

Posting Komentar