Created
June 18, 2022 08:18
-
-
Save paley777/9d6682618ceb7e071911b20e93c59438 to your computer and use it in GitHub Desktop.
If-Else C++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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