Tugas 4
Tugas 4
TUGAS 4
Oleh :
FAKULTAS TEKNIK
UNIVERSITAS UDAYANA
Buat Flowchart dan program c/c++dari soal berikut:
S = v * t
Start
Int
Jarak (s)
Kecepatan
(v)
Waktu (t)
Input
Jarak
tempuh
s=v*t
Hasil
Jarak
tempuh
(s)
End
DevC++
#include<iostream>
#include<conio.h>
int main ()
{
int s, V, t;
cin>>V;
cin>>t;
return 0;
2. Perkalian 2 pecahan:
P1 = ¾
P2 = 2/3
Input P1 = ¾
Input P2 = 2/3
Hasil = P1 * P2
Print Hasil
END
DEV C++
#include<iostream>
struct pecahan
int pb;
int py;
};
pecahan P1,P2,P3;
cout<<"Masukkan Pb P1 = ";
cout<<"Masukkan Py P1 = ";
cout<<"Masukkan Pb P2 = ";
cout<<"Masukkan Py P2 = ";
P3.pb = P1.pb*P2.pb;
P3.py = P1.py*P2.py;
return 0;