最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

如何从6位数字中取出最后两个数字

SEO心得admin48浏览0评论
本文介绍了如何从6位数字中取出最后两个数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

hi 在我的项目中,我随机显示支票号码 像random.next(100000,999999)一样会随机提供一些值,例如234567 在那我应该选择最后两位数字并设置支票号码范围为1到10 (234568至234578)之类的人可以帮助我 在此先感谢 pallavi

hi in my project i am displaying cheque number randomly like random.next(100000,999999) it will give some value randomly like 234567 in that i should select last two digits and set cheque number range from 1 to 10 like (234568 to 234578) can any one help me for how to do this thanks in advance pallavi

推荐答案

我无法理解您所写内容的全部内容.尽管这是从数字中获取最后两位数字的方法: I am not able to understand complete thing what you have written. Although this is how you can get the last two digits from a number: int lastTwoDigits = number % 100;

您可以对100做模以得到最后2位数字. You can simply do modulo 100 to get the last 2 Digits. int a = 123456789 int b = a % 100 Console.WriteLine("b: ",b);

输出: b = 89

Output : b = 89

我的意思是您想更改最后两个数字,例如,如果它们是12,那么您想将其改为22吗? 无论如何,我都会认为答案是正确的:-D 所以这里是 您所要做的就是在您的电话号码中加1 :-) 123456 + 1 = 123457,这是来自 并添加11到 123456 + 11 = 123467,这是 这是你的范围 希望我能帮忙 :-) I think you mean that you want to to change your last 2 numbers for example if they are 12 you want them to be 22 right? I will assume the answer is right anyway :-D so here it is all you have to do is to add 1 to your number :-) 123456 + 1 = 123457 and here is the from and add 11 to it too 123456 + 11 = 123467 and here is to and here is your range I hope I helped :-)

发布评论

评论列表(0)

  1. 暂无评论