-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFPB.cpp
More file actions
42 lines (39 loc) · 703 Bytes
/
FPB.cpp
File metadata and controls
42 lines (39 loc) · 703 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <iostream>
using namespace std;
int main()
{
int x,y,z,i,j;
cout << "Masukan angka pertama=";
cin >> x;
cout << "Masukan angka kedua=";
cin >> y;
if(x>y)
{
while(i!=0)
{
z=x;
y=z%y;
int i=x%y;
if(i==0)
{
cout << "FPB=" << y;
break;
}
}
}
else
{
while(i!=0)
{
z=y;
x=z%x;
int i=y%x;
if(i==0)
{
cout << "FPB=" << x;
break;
}
}
}
return 0;
}