Skip to content

Instantly share code, notes, and snippets.

@rizkhal
Created October 8, 2018 12:48
Show Gist options
  • Save rizkhal/26b1cede8234782e87a9ca5b1002791a to your computer and use it in GitHub Desktop.
Save rizkhal/26b1cede8234782e87a9ca5b1002791a to your computer and use it in GitHub Desktop.
Hitung Luas Persegi Panjang Menggunakan C++
#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