Dibaca tiga bilangan sebagai panjang segmen garis. Tampilkan hasilnya apakah bisa dibentuk segitiga atau tidak.
Program C++
#include <iostream>
#include <conio.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
int a,b,c;
cout<<"Masukkan garis Pertama :";cin>>a;
cout<<"Masukkan garis Ke-dua :";cin>>b;
cout<<"Masukkan garis Ke-tiga :";cin>>c;
cout<<endl;
if (a-b<c or a+b<c){
cout<<"Garis DAPAT membuat segitiga";
}
else if (a-b>c or a+b>c){
cout<<"Garis TIDAK DAPAT membuat segitiga";
}
return 0;
}
Logikanya Menggunakan Raptor
ABOUT THE AUTHOR
A web designer from India. And then you write some more information about yourself like this to fill out the space that is left.


0 komentar:
Posting Komentar