关于这道题我们先要知道在编程语言中什么字符代表着取模。学过C++的人应该都知道,%这个符号就是取模。用途呢就是求出两个数的语数。而这个符号对于这道题的帮助可大了喽。
咱么你先来看第一种题解。这个第一种呢会对第二种的题解帮助非常的大哦。
好了,我先把代码放上来。
上面的这个题解呢我们运用到了两个变量,用来储存两个数,其实没事干的人也可以通过数组,但是如果放在一个数组里需要运用到getling,不行就放两个数组也可以当然,是那些没事干的人或许可以尝试一下,不会的人就算了。
好了,接下来是第二种解法。这个解法和第一道题的关系很大哦!
我先把答案放在这啦!
以上的这个解法呢是通过函数来解决问题的。
实际上就是把第一个的答案封装成了函数。直接返回答案,最后输出这个函数就行了。
是不是很简单啊~
额,我来打一个**。
我们的City of Hackers工作室正在招人哦~感兴趣的可以加入!
感兴趣的戳我哦!
最后,我真诚的希望各位看过的大佬能来我们工作室也可以动动小手给个赞。
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Regarding this question, we first need to know what characters represent modulo in programming languages. Those who have studied C++should know that the symbol% is modulo. The purpose is to find the linguistic number of two numbers. And this symbol is very helpful for this question.
Let's take * look at the first solution first** This first type will be very helpful for solving the second type of problem**
Okay, I'll put the code up first.
In the above solution, we used two variables to store two numbers. In fact, people who have nothing to do can also use arrays. However, if we need to use getling to put them in one array, we can also use two arrays Of course, those who have nothing to do may want to try it out. Those who don't know
how to do it are fine
Alright, the next solution is the second one** This solution is closely related to the first question**
I'll put the answer here first!
The above solution is to solve the problem through * function.
In fact, it encapsulates the first answer into * function. Just return the answer directly and finally output this function.
Isn't it very simple~
Uh, I'll place an advertisement.
Our City of Hackers studio is currently hiring! Interested parties can join!
[Poke me if you're interested!]( https://www.acgo.cn/application/1786225240849158144 )
Finally, I sincerely hope that all the experts who have watched it can come to our studio and give * thumbs up.