Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
41580 | lihaocheng | 求两个数的最大公约数 | C++ | Accepted | 0 MS | 192 KB | 179 | 2024-02-21 19:32:00 |
#include<stdio.h> int main () { int a,b,c,i,k; scanf("%d %d",&a,&b); c=a>b?b:a; for(i=2;i<=c;i++) { if(a%i==0&&b%i==0) k=i; } printf("%d",k); return 0; }