输入N,它等于要打印的系列的最大数
Input : N=5Output : 0 ¼ ½ ¾ 1
登录后复制
算法
STARTStep 1 -> declare start variables as int num , den, i, nStep 2 -> input number in nStep 3 -> Loop For from i to 0 and i End For LoopSTOP
登录后复制
示例
#include int main(int argc, char const *argv[]) { int num, den; int i, n; printf("Enter series limit"); scanf("%d", &n); //Till where the series will be starting from zero for (i = 0; i
",num, den); } else //else print in a normal number form printf("%d
", num); } return 0;}
登录后复制
输出
如果我们运行上述程序,它将生成以下输出
Enter series limit501/41/23/41
登录后复制
以上就是打印系列的前N个项(0.25、0.5、0.75,…)的分数表示形式的详细内容,更多请关注【创想鸟】其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至253000106@qq.com举报,一经查实,本站将立刻删除。
发布者:PHP中文网,转转请注明出处:https://www.chuangxiangniao.com/p/2581156.html