如何区分奇数/偶数和求和 [英] How to distinguish odd / even numbers and sumthem

查看:108
本文介绍了如何区分奇数/偶数和求和的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个程序,接受一个文本框中的数字

例23578然后在一个标签中将显示奇数和

的总和这样的数字...


文本框中包含数字23578

标签会说:

Sumof奇数是:15

偶数总和是:10


任何想法?

感谢

解决方案

这听起来像是作业问题?如果是这样,你应该自己解决这个问题

,而不是在这里发布。很难想象一个真实的世界

应用程序想要这样做,而一个真正的世界程序员不知道如何实现这个目标......

" Ron" < pt ***** @ yahoo.comwrote in message

news:11 ********************* @ m58g2000cwm.googlegro ups.com ...


>我想写一个程序,接受一个文本框中的数字

例23578和然后在标签中将显示奇数和

偶数的总和,如此...


文本框中包含数字23578

标签会说:

Sumof奇数是:15

偶数总和是:10


任何想法?

感谢



Plus think" in English"你如何一步一步地向某人解释如何做到这一点。然后告诉计算机。例如,第一步

可能会提取每个数字进行处理(直到达到总长度

),一旦你有一个数字,你会做什么,所以on ...


欢迎编程...


" Marina Levit [MVP]" < ma ***** @comcast.netaécritdansle message de news:
XZ ************ @康卡斯特.com ...


这听起来像是作业问题?如果是这样,你应该自己完成这个

,而不是在这里发布。很难想象一个真正的

世界应用程序想要做到这一点,而真正的世界程序员并不知道如何实现这个目标...


" Ron" < pt ***** @ yahoo.comwrote in message

news:11 ********************* @ m58g2000cwm.googlegro ups.com ...


>>我想编写一个程序,接受文本框中的数字,例如23578,然后在一个标签会显示奇数和
偶数的​​总和,就像这样...

文本框中包含数字23578
标签会说:
Sumof奇数是:15
偶数总和是:10

任何想法?
感谢




"罗恩" < pt ***** @ yahoo.comschrieb:


>我想编写一个程序,接受文本框中的数字

示例23578然后在标签中将显示奇数和

偶数的总和,如此...


文本框中包含的数字23578

标签会说:

Sumof奇数是:15

偶数总和是:10


查看''Mid''函数,'For''循环和''Mod''语句。


-

MS Herfried K. Wagner

MVP< URL:http://dotnet.mvps.org/>

VB< URL :http://dotnet.mvps.org/dotnet/faqs/>


I want to write a program that will accept a number in a textbox for
example 23578 and then in a label will display the sum of the odd and
even number like this...

the textbox containsthe number 23578
the label would say:
Sumof odd number is: 15
Sum of even number is: 10

any ideas?
thanks

解决方案

This sounds like a homework problem? If so, you should really work this out
on your own and not post here. It''s really hard to imagine a real world
application wanting to do this, and a real world programmer not knowing how
to accomplish this...

"Ron" <pt*****@yahoo.comwrote in message
news:11*********************@m58g2000cwm.googlegro ups.com...

>I want to write a program that will accept a number in a textbox for
example 23578 and then in a label will display the sum of the odd and
even number like this...

the textbox containsthe number 23578
the label would say:
Sumof odd number is: 15
Sum of even number is: 10

any ideas?
thanks



Plus think "in English" how you would explain step by step to someone how to
do this. Then tell the same to the computer. For example the first step
would be likely to extract each digit for processing (until the total length
is reached), once you have a digit what would you do and so on...

Welcome to programming...

"Marina Levit [MVP]" <ma*****@comcast.neta écrit dans le message de news:
xZ******************************@comcast.com...

This sounds like a homework problem? If so, you should really work this
out on your own and not post here. It''s really hard to imagine a real
world application wanting to do this, and a real world programmer not
knowing how to accomplish this...

"Ron" <pt*****@yahoo.comwrote in message
news:11*********************@m58g2000cwm.googlegro ups.com...

>>I want to write a program that will accept a number in a textbox for
example 23578 and then in a label will display the sum of the odd and
even number like this...

the textbox containsthe number 23578
the label would say:
Sumof odd number is: 15
Sum of even number is: 10

any ideas?
thanks




"Ron" <pt*****@yahoo.comschrieb:

>I want to write a program that will accept a number in a textbox for
example 23578 and then in a label will display the sum of the odd and
even number like this...

the textbox containsthe number 23578
the label would say:
Sumof odd number is: 15
Sum of even number is: 10

Check out the ''Mid'' function, the ''For'' loop, and the ''Mod'' statement.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>


这篇关于如何区分奇数/偶数和求和的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆