欧几里得算法 Euclidean algorithm
2016-05-03 10:49
441 查看
突然发现我连int main里标准的参数都不会写。尴尬啊,哈哈哈哈…
// Euclidean algorithm // 欧几里得算法 #include <iostream> using namespace std; int gcd(int p, int q) { if (q == 0) return p; int r = p % q; return gcd(q, r); } int main(int argc, char* argv[]) { int a, b; cout << "Enter two number for gcd calculation: "; cin >> a >> b; cout << gcd(a, b) << endl; return 0; }
相关文章推荐
- Django: 路由与视图
- About cpu freq governor fixing for periodic
- 解析Mac OS下部署Pyhton的Django框架项目的过程
- Google 将要组建统一的硬件部门,你也许能见到一台更好的 Nexus 手机了
- Go 性能优化技巧 8/10
- OC中的分类Category
- django框架从零开始_002_helloworld
- A Tour of Golang (二)
- django框架从零开始_001_安装
- 【Leetcode】:22. Generate Parentheses 问题 in Go语言
- Mongoose(三):数据类型
- Google开发者工具学习
- google base之LockImpl
- google base库之simplethread
- Golang实现红黑树
- Go语言之defer
- Go语言之defer
- 1.django笔记之django基础
- arcgis中加载google在线地图
- uva 11054 wine trading in gergovia (归纳【好吧这是我自己起的名字】)——yhx