In mathematics, the Biggest Factor Guild (FPB) is the largest positive integer that divides both numbers were depleted.
A simple way can be used to find the gcd of 2 or 3 numbers that are not too large, but for larger numbers should be used as a way factorial conoh observed cases below.
Finding gcd of 12 and 20:
* Factors of 12 = 1, 2, 3, 4, 6 and 12
* Factors of 20 = 1, 2, 4, 5, 10 and 20
so gcd of 12 and 20 are factors allies (the same) are the largest, which is 4. If you still do not understand your logic I will also assist in the programming language C + + Overloading in the form of class. The following is his program please understood and understand.
A simple way can be used to find the gcd of 2 or 3 numbers that are not too large, but for larger numbers should be used as a way factorial conoh observed cases below.
Finding gcd of 12 and 20:
* Factors of 12 = 1, 2, 3, 4, 6 and 12
* Factors of 20 = 1, 2, 4, 5, 10 and 20
so gcd of 12 and 20 are factors allies (the same) are the largest, which is 4. If you still do not understand your logic I will also assist in the programming language C + + Overloading in the form of class. The following is his program please understood and understand.
# Include <iostream>
# Include <conio.h>
FPB class {
friend ostream & operator <<(ostream &, & FPB);
friend istream & operator>> (istream &, & FPB);
public:
FPB ();
hitung_fpb void () {
r = a% b;
while (r! = 0) {
a = b;
b = r;
r = a% b;
}
;}
private:
int a, b, r;
};
FPB:: FPB () {
court <<"\ t \ tSlamet Islan Al Hidayah" <<endl;
court <<"\ t \ t 10018075" <<endl;
court <<endl;
court <<"\ tProgram to find bilangann FPB" <<endl;
court <<endl;
}
istream & operator>> (istream & ins, FPB & mlebu) {
court <<"Enter the number A:";
in>> mlebu.a;
court <<"Enter the number B:";
in>> mlebu.b;
return in;
}
ostream & operator <<(ostream & out, FPB & metu) {
court <<endl;
court <<"FPB of the numbers A and B is:";
out <<metu.b;
return out;
}
main () {
FPB z;
cin>> z;
z.hitung_fpb ();
court <<z;
getch ();
return 0;
}
Output :
Well that's the program that I can make,,,,,!
If there are less jelass know any mistake, do not hesitate to leave a comment ataun advice. So that I can fix it later terimakasihh over his visit,,
Regards super ..
0 Response to " PROGRAM TO FIND FPB "
Post a Comment