View Code of Problem 59

#include<stdio.h>
int main(){
    int p,r,n,m,t;
  printf("请输入两个整数:");
  scanf("%d %d",&n,&m);
  if(n<m){
    t=n;
    n=m;
    m=t;
  }
  p=n*m;
  while(m!=0){
    r=n%m;
    n=m;
    m=r;
  }
  Printf("它们的最大公约数为:%d\n",n);
  printf("它们的最小公倍数为:%d\n",p/n);
  return 0;
}
  
/*
Main.c: In function 'main':
Main.c:17:3: warning: implicit declaration of function 'Printf' [-Wimplicit-function-declaration]
   Printf("它们的最大公约数为:%d\n",n);
   ^
/tmp/cc8T6Ced.o: In function `main':
Main.c:(.text+0x8a): undefined reference to `Printf'
collect2: error: ld returned 1 exit status
*/

Double click to view unformatted code.


Back to problem 59