当前位置:网站首页>代码—
代码—
2022-07-22 09:24:00 【沙子是沙子】
int cal_gcd(int m,int n);
int main(void)
{
int num,denom,remainder;
printf("Enter a fraction: ");
setvbuf(stdout,NULL,_IONBF,0);
scanf("%d/%d",&num,&denom);
remainder=cal_gcd(num,denom);
num/=remainder;
denom/=remainder;
printf("In lowest terms:%d/%d\n",num,denom);
return 0;
}
int cal_gcd(int m,int n)
{
int well;
while(n!=0)
{
well=m % n;
m=n;
n=well;
}
if(m<0)
{
n*=-1;
m*=-1;
}
return m;
}
边栏推荐
- (c语言)数组是一种特殊的指针?
- 模块TensorFlow中没有Session
- Summary of various materials - Network
- 1. Qtablewidget insert button, flexibly delete the line, and display the line number in one column
- 练习7-4 找出不是两个数组共有的元素(C语言)
- Problems encountered in using openfeign to realize remote call in Webflux
- Shell $*和[email protected]的区别
- Pat grade B 1020 moon cake (pay attention to the measuring points)
- There is no session in the tensorflow module
- PTA search tree judgment
猜你喜欢
JVM-系统优化
Interrogation aléatoire de n données dans diverses bases de données
微信扫网址的二维码,却只显示链接地址,无法跳转到网页的解决办法
PTA 6-11 find the median of self-determined type element sequence (25 points)
LeetCode 105. 从前序与中序遍历序列构造二叉树
Caching-sha2-password problem occurred when connecting mysql8.0
Recursively find the partial sum of simple alternating power series (15 points)
程序员面试金典面试题 01.01. 判定字符是否唯一
Domestic ngrok achieves intranet penetration
1.Qt之打包发布程序 (NSIS);
随机推荐
练习7-4 找出不是两个数组共有的元素(C语言)
Flink learning notes (III) Flink installation and deployment
PTA basic questions 7-28 monkeys choose the king (simple method)
Three ways to restrict IP access between micro services
Flink learning notes (IV) Flink runtime architecture
Flink学习笔记(四)Flink运行时架构
paper - A Physics-based Noise Formation Model for Extreme Low-light Raw Denoising
Go memory model
Shell $*和[email protected]的区别
shell变量操作${}详细用法
1.QTableWidget的closable,2.pro/build_pass、member,3.QString&&
Summary of all usage of join in SQL syntax (simple example)
Go language learning: go language journey - exercise questions and reference answers
Interrogation aléatoire de n données dans diverses bases de données
Exercise 7-4 find out the elements that are not common to two arrays (C language)
Flink学习笔记(三)Flink安装部署
程序员面试金典面试题 01.04. 回文排列
Flink学习笔记(六)Flink的时间和窗口
The database is garbled. Do you want to find a solution?
高手常用的15 种 SQL 优化