tiTik teNgah (C++)

Belajar pemrograman…

Mencari Titik Tengah
Read:
Input X1, X2, Y1, X2

Xt <= (X1 +  X2 )/2

Yt <= (Y1 +  Y2 )/2

Write : (Xt, Yt)

SOURCE CODE
#include<iostream.h>

void Titik_Tengah()
{
int x1,x2,xt,y1,y2,yt;

cout<<“titik x1 = “;
cin>>x1;
cout<<“titik x2  = “;
cin>>x2;
cout<<“titik y1 = “;
cin>>y1;
cout<<“titik y2 = “;
cin>>y2;
cout<<endl;
xt=(x1+x2)/2;
yt=(y1+y2)/2;
cout<<“Nilai Titik Tengahnya= (” <<xt<<“,”<<yt<<“) “<<endl;
cout<<endl;
}
int main ()
{
Titik_Tengah();
return 0;
}

 

Mohon maaf jika ada kesalah.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: