Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
78078 刘泽熙 15求两个数的最大公约数 C++ Compile Error 0 MS 0 KB 215 2024-06-16 14:22:23

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int a,b d; int i=1; cin>>a>>b; if(a<b){ int c=a; }else{ int c=b; } while(i<=c){ if(c%i==0){ d=i; } i++; } cout<<i-1; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:4:10: error: expected initializer before 'd'
  int a,b d;
          ^
Main.cc:6:10: error: 'b' was not declared in this scope
  cin>>a>>b;
          ^
Main.cc:8:7: warning: unused variable 'c' [-Wunused-variable]
   int c=a;
       ^
Main.cc:10:7: warning: unused variable 'c' [-Wunused-variable]
   int c=b;
       ^
Main.cc:12:11: error: 'c' was not declared in this scope
  while(i<=c){
           ^
Main.cc:14:4: error: 'd' was not declared in this scope
    d=i;
    ^