确定在给定数目的数字。

编程入门 行业动态 更新时间:2024-10-25 14:32:52
本文介绍了确定在给定数目的数字。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我是新来编程,而我被困在一个问题。我想我的程序来识别不同的数字在给定的数字,比如,如果我输入 4692 ,它应确定数字和印刷 4 6 9 2 。 ,是的,没有使用数组。

I'm new to programming, and I'm stuck at a problem. I want my program to identify the separate digits in a given number, like if I input 4692, it should identify the digits and print 4 6 9 2. And yeah, without using arrays.

推荐答案

如果您是新的方案,以解决一个完美的递归问题...

A perfect recursion problem to tackle if you're new to programming...

千分之四千六百九十二= 4

4692/1000 = 4

4692%1000 = 692

4692%1000 = 692

百分之六百九十二= 6

692/100 = 6

692%100 = 92

692%100 = 92

十分之九十二= 9

92%10 = 2

您应该得到你现在应该使用,因此它适用于任何数量的循环的想法。 :)

You should get the idea for the loop you should use now, so that it works for any number. :)

更多推荐

确定在给定数目的数字。

本文发布于:2023-11-30 21:26:13,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1651517.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:目的   定数   数字

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!