Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
135188 郑喆哲 最大公约数和最小公倍数 C++ Compile Error 0 MS 0 KB 388 2025-11-02 18:00:06

Tests(0/0):


Code:

#include<iostream> using namespace std; int zdgy(int a,int b) { int gun; for(int i=1;i<=a;i++) { if(a%i==0&&b%i==0) { gun=i; } } return gun; } int zxgb(int a,int b) { int man; for(int i=1;i<=a*b==0) { if(i%a==0&&i%b==0) { man=i; break; } } } int main() { int a,b; cin>>a>>b; cout<<zdgy(a,b); cout<<zxgb(a,b) return 0; }


Run Info:

Main.cc: In function 'int zxgb(int, int)':
Main.cc:18:15: warning: suggest parentheses around comparison in operand of '==' [-Wparentheses]
  for(int i=1;i<=a*b==0)
               ^
Main.cc:18:23: error: expected ';' before ')' token
  for(int i=1;i<=a*b==0)
                       ^
Main.cc:26:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
Main.cc: In function 'int main()':
Main.cc:33:2: error: expected ';' before 'return'
  return 0;
  ^