x1 = 2
x2 = 4
y1 = 5
y2 = 3
Maka hasilnya :
Program c++ :
Setelah di run :
#include <iostream> #include <conio.h> using namespace std; int main(){ int x1; int y1; int a; int b; int x2; int y2; cout<<"masukkan x1 = "; cin >> x1; cout<<"masukkan x2 = "; cin >> x2; cout<<"masukkan y1 = "; cin >> y1; cout<<"masukkan y2 = "; cin >> y2; a =(x1+x2)/2; b =(y1+y2)/2; cout << "nilai dari garis x ="<<a << endl; cout << "nilai dari garis y = "<<b << endl<<endl; cout << "titik tengah = ("<<a<<","<<b<<")"<<endl; getch(); }
Setelah di run :
No comments:
Post a Comment