如何检查号码是在号码的左侧还是右侧
如何检查数字是在数字的左侧还是右侧,
例如数字是2,我想知道它在12和23上的位置,
其中2是23的左侧,12的右侧,
我的代码
class Solution
{
public static void Main(String[] args)
{
var number = 12;
foreach(char c in number.ToString()){
if(c=='2'){
Console.WriteLine(c);
}
}
}
}
How to check is a number is on left side or right side of number
for example number is 2 and i want where it is on 12 and 23
which is 2 is left side on 23 and right side on 12
my code
class Solution
{
public static void Main(String[] args)
{
var number = 12;
foreach(char c in number.ToString()){
if(c=='2'){
Console.WriteLine(c);
}
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
检查一下这段代码:
Check this code out:
编辑:
我添加了证明
证明未编辑版本有效:
EDIT:
I added proof
Proof un-edited version works: