Skip to content

Instantly share code, notes, and snippets.

@paley777
Created June 18, 2022 08:18
Show Gist options
  • Save paley777/9d6682618ceb7e071911b20e93c59438 to your computer and use it in GitHub Desktop.
Save paley777/9d6682618ceb7e071911b20e93c59438 to your computer and use it in GitHub Desktop.
If-Else C++
#include <iostream>
using namespace std;
int main(){
int x, y;
std::cout << "Masukan sebuah bilangan bulat : ";
std::cin >> x;
std::cout << "Masukan sebuah bilangan lain : ";
std::cin >> y;
if (x > 0 && y > 0){
std::cout << "Kedua bilangan tersebut adalah bilangan positif \n";
}
else if (x > 0 || y > 0){
std::cout << "Salah satu bilangan tersebut adalah bilangan positif \n";
}
else {
std::cout << "Kedua bilangan tersebut BUKAN bilangan positif \n";
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment