c07b.cpp
来自「此文件可以能帮你求体积」· C++ 代码 · 共 28 行
CPP
28 行
// c07b.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream.h>
int main(int argc, char* argv[])
{
int a, b;
cout << "Enter two numbers:";
cin >> a >> b;
int min = (a>b)?b:a;
int t = 0;
for ( int i = 2; i <= min; i++ )
if ( a%i == 0 && b%i == 0 )
t = i;
if ( t == 0 )
cout << "No greatest common divisor.\n";
else
cout << "The greatest common divisor is " << t << ".\n";
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?