第四周项目1-求最大公约数(1)
来源:互联网 发布:淘宝双十一全民疯抢 编辑:程序博客网 时间:2024/06/07 18:33
问题及代码:
/**copyright (t) 2016,烟台大学计算机与控制工程学院*All rights reserved.*文件名称:main.cpp*作者:郝昱猛*完成日期:2016年3月23日*版本号:v1.0*问题描述:输入两个数,并求出其最大公约数。*/#include<iostream>using namespace std;int gcd(int x,int y);int main(){ int a,b,g; cin>>a>>b; g=gcd(a,b); cout<<"最大公约数是:"<<g; return 0;}int gcd(int x,int y){ int t; while(y!=0) { t=x%y; x=y; y=t; } return x;}运行结果:
0 0
- 第四周项目(1)-求最大公约数
- 第四周项目1求最大公约数
- 第四周项目1:求最大公约数
- 第四周项目1:求最大公约数
- 第四周【项目1-求最大公约数】
- 第四周项目1-求最大公约数
- 第四周项目1-求最大公约数
- 第四周项目1-求最大公约数
- 第四周项目1-求最大公约数
- 第四周项目1-求最大公约数
- 第四周项目1:求最大公约数
- 第四周项目1-求最大公约数
- 第四周项目1-求最大公约数(1)
- 第四周项目1——(1)求最大公约数
- 第四周项目1-求最大公约数(1)
- 第四周项目1-求最大公约数(1)
- 第四周项目1-求最大公约数(2)
- 第四周项目1-求最大公约数(3)
- 【Git】记录一些Git常用命令
- VMware 安装 CentOS 安装 CentOS-6.5-i386-minimal.iso 版本
- poj 1050 To the Max(最大子矩阵和)
- uvc camera MTK平台调试总结
- SQLite Expert查看float数据
- 第四周项目1-求最大公约数(1)
- TCP/IP协议三次握手与四次握手流程解析 TCP/IP协议四层
- 一种TV(Android系统)通用焦点框的实现
- Appium移动自动化测试(一)--安装Appium
- windows下安装Apache(欢迎留言)
- Android中App可分配内存的大小
- null和undefined
- 在Python里安装Jieba中文分词组件
- 《Android 应用》TextView追加文本并向下滚动