Created
October 8, 2018 12:48
-
-
Save rizkhal/26b1cede8234782e87a9ca5b1002791a to your computer and use it in GitHub Desktop.
Hitung Luas Persegi Panjang Menggunakan C++
This file contains hidden or 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 "stdio.h" | |
#include "iostream" | |
using namespace std; | |
int main() | |
{ | |
int luas = 0, panjang = 0, lebar = 0; | |
printf("%s" "\n", "Calculate the area of a rectangle"); | |
cout << "Input long: "; | |
cin >> panjang; | |
cout << "Input short: "; | |
cin >> lebar; | |
if(panjang != 0 && lebar != 0) | |
{ | |
luas = panjang * lebar; | |
cout << "Long = " << luas << "\n"; | |
}else | |
{ | |
cout << "Error long || short cannot be empty!"; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment