The logic is like this:
Square having sides equal (in length), Rectangle sedamgkan not all the same.
Well this is a differentiator both, if the sides are equal, then => Square.
And if the sides are not equal, then => Rectangle.
Here's source code:
#include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) { { int BS, PP, p, l, keliling, luas; cout<< " ================================================= "<<endl; cout<< " Program Untuk Menentukan Persegi/ Persegi Panjang "<<endl; cout<< " ================================================= "<<endl; cout<< "\n Masukkan Panjang : ";cin>>p; cout<< "\n Masukkan Lebar : ";cin>>l; luas = p*l; keliling = 2*(p+l); cout<<"\n Hasil Luas : "<<luas<<endl; cout<<"\n Hasil Keliling : "<<keliling<<endl; if(p != l) cout<<"\n Jenis Bangun Adalah Persegi Panjang "<<endl; else cout<<"\n Jenis Bangun Adalah Bujur Sangkar \n"; } system("PAUSE"); return EXIT_SUCCESS; }
the end,, success broo,, bye bye
0 comments:
Post a Comment