Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cmath>
- using namespace std;
- int main(){
- int a,b,x,i,y;
- cout<<" programme que clacul lcm "<<endl;
- cout<<"entrer le premier nombre a"<<endl;
- cin>>a;
- cout<<"entrer le deuxiem nombre b "<<endl;
- cin>>b;
- i=1;
- int z=1;
- x=a;
- y=b;
- do {
- if(a>=b){
- x=a*z;
- z++;
- i=1;
- while((x!=y)&&(i<100)){
- y=b*i;
- i++;
- }
- }
- else if (a<b ){
- y=b*z;
- z++;
- i=1;
- while((x!=y)&&(i<100)){
- x=a*i;
- i++;
- }
- }
- }while(x!=y);
- cout << "lcm a, b = " << x << endl;
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement