大家好,今天小编关注到一个比较有意思的话题,就是关于经典c语言代码的问题,于是小编就整理了2个相关介绍经典c语言代码的解答,让我们一起看看吧。
求一份经典C语言代码大全?
#include <stdio.h>int ***(int m, int n);int LCM(int m, int n);main(){ int m = 0, n = 0; scanf("%d %d",&m,&n); while(m != 0 && n != 0){ printf("*** = %d, LCM = %d\n",***(m,n),LCM(m,n)); scanf("%d %d",&m,&n); } }int LCM(int m, int n){ int lcm = 0; if(m>n){ lcm = m; } else lcm = n; while(lcm%m==0 && lcm%n==0){ lcm++; } return lcm;}int ***(int m, int n){ int a = 0; int i = 0; int *** = 0; if(m>n){ a = n; } else a = m; for(i = 0;i<=a;i++){ if(m%i==0&&n%i==0) *** = i; } return ***;}
求一份经典C语言代码大全?
#include <stdio.h>int ***(int m, int n);int LCM(int m, int n);main(){ int m = 0, n = 0; scanf("%d %d",&m,&n); while(m != 0 && n != 0){ printf("*** = %d, LCM = %d\n",***(m,n),LCM(m,n)); scanf("%d %d",&m,&n); } }int LCM(int m, int n){ int lcm = 0; if(m>n){ lcm = m; } else lcm = n; while(lcm%m==0 && lcm%n==0){ lcm++; } return lcm;}int ***(int m, int n){ int a = 0; int i = 0; int *** = 0; if(m>n){ a = n; } else a = m; for(i = 0;i<=a;i++){ if(m%i==0&&n%i==0) *** = i; } return ***;}