rumus:
Titik tengah = (x1+x2)/2 , (y1+y2)/2
Algoritma :
1. Masukkan bilangan dalam xa,ya.
2. Masukkan bilangan dalam xb,yb
3. Hitunglah dengan rumus diatas.
4. Hasil
Program c++
#include <iostream>#include <conio.h>
int main(){
int xa,xb,ya,yb;
cout<<"Masukkan 1(xa) = "<<endl;
cin>>xa;
cout<<"Masukkan 1(ya) = "<<endl;
cin>>ya;
cout<<"Masukkan 2(xb) = "<<endl;
cin>>xb;
cout<<"Masukkan 2(yb) = "<<endl;
cin>>yb;
cout<<"Titik tengah = ("<<(xa+xb)/2<<","<<(ya+yb)/2<<")";
getch();
return 0;
}
0 comments:
Post a Comment