例题
giving an integer N (2<=N<=20) and a real number M (0.5 < M <= 1), output all proper fractions whose numerator is less than N ,and denominator is equal to or less than N, and value is equal to or less than M.
input: an integer N, a real number M in the type of double, in one line seperated by blank space.
output: proper fractions, each occupies a line. The proper fractions with smaller denominators are in the front.
Between two different fractions with same denominator, the one whose numerator is smaller comes first. There is a ‘\n’
after the final fraction number.
#include<stdio.h>
int main() {
int length = 0;
int i, j;
int <

本篇博客探讨如何使用C语言解决一个问题:给定整数N(2<=N<=20)和0.5<M<=1的实数M,输出所有分母不大于N且值不大于M的真分数,同时检查并避免输出不可约分的相同值。输入为整数N和双精度浮点数M,输出按照分母从小到大,相同分母时分子小的在前,最后以'
'结束。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



