473,386 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

i need help please

1
hi all,

i need your help in solving these two questions about vb really i need the answer as soon as possible today

the first question:
how can i write a VB .Net application that adds even numbers 0, 2, 4, … until the sum of these numbers is greater to or equal to a specific value to be given by the user?

the second question:
how can i Write a VB .NET application that calculates the factorial. The factorial is the product of all the positive integers from 1 to a given number, for example, 4 factorial, usually written 4!, is equal to 24 (1 × 2 × 3 × 4 = 24). The user will enter through a textbox the desired number and you as programmer will display the result in a message box. It should be noted that 0! is by default equal to 1?

please if some one have the answer please past them
Nov 7 '06 #1
2 1408
hi all,

i need your help in solving these two questions about vb really i need the answer as soon as possible today

the first question:
how can i write a VB .Net application that adds even numbers 0, 2, 4, … until the sum of these numbers is greater to or equal to a specific value to be given by the user?

the second question:
how can i Write a VB .NET application that calculates the factorial. The factorial is the product of all the positive integers from 1 to a given number, for example, 4 factorial, usually written 4!, is equal to 24 (1 × 2 × 3 × 4 = 24). The user will enter through a textbox the desired number and you as programmer will display the result in a message box. It should be noted that 0! is by default equal to 1?

please if some one have the answer please past them

Hi there Nada.
I'm not sure if the code for .NET is the same as regular VB, but here's the code:
first answer:
just use a loop with step 2 to add them.something like this
<code>
dim i as integer 'this is the counter for the loop
dim augmentor as integer ' something to append to
dim inputnumber as integer 'this will be equal to what the user puts in

inputnumber = inputbox("Type the max number:", "Max Number") 'gets the number from the user

for i = 0 to inputnumber STEP 2
augmentor = augmentor+i
next i
</code>

im not sure if there's a class for that, but hey! there's the vb code, maybe you can translate it XD

as for the second part, i have code for this but again it's in normal VB, sooooo maybe i could give it to you and you could translate it.
i'll provide it later, i need to get back to class, im in school right now >.<
Nov 7 '06 #2
Killer42
8,435 Expert 8TB
Hi there Nada.
...
Hope it's not too late now. I'll take the code already posted and modify it for factorial...
Expand|Select|Wrap|Line Numbers
  1. dim i as integer 'this is the counter for the loop
  2. dim augmentor as integer ' something to append to
  3. dim inputnumber as integer 'this will be equal to what the user puts in
  4.  
  5. inputnumber = inputbox("Type the max number:", "Max Number") 'gets the number from the user
  6.  
  7. augmentor = 1
  8. for i = 2 to inputnumber
  9.   augmentor = augmentor * i
  10. next i
Nov 9 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Nathan Pinno | last post by:
Hi all, I need help figuring out how to fix my code. I'm using Python 2.2.3, and it keeps telling me invalid syntax in the if name == "Nathan" line. Here is the code if you need it. #This...
17
by: Marcin Borkowski | last post by:
Hello I need some small help in the Borland C++ Builder. I need to do something with string in format like "var1|var2|var3|var4|" and add it to some ComboBox (Items -> Add("var1"), Items ->...
6
by: mike | last post by:
Hello, After trying to validate this page for a couple of days now I was wondering if someone might be able to help me out. Below is a list of snippets where I am having the errors. 1. Line 334,...
3
by: Bob.Henkel | last post by:
I write this to tell you why we won't use postgresql even though we wish we could at a large company. Don't get me wrong I love postgresql in many ways and for many reasons , but fact is fact. If...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
8
by: skumar434 | last post by:
i need to store the data from a data base in to structure .............the problem is like this ....suppose there is a data base which stores the sequence no and item type etc ...but i need only...
8
by: CM | last post by:
Hi, Could anyone please help me? I am completing my Master's Degree and need to reproduce a Webpage in Word. Aspects of the page are lost and some of the text goes. I would really appreciate it....
5
by: Y2J | last post by:
I am working through this book on C++ programming, the author is speaking of using linked lists. He gave and example which I found confusing to say the least. So I rewrote the example in a way that...
4
by: georges the man | last post by:
hey guys, i ve been posting for the last week trying to understand some stuff about c and reading but unfortunaly i couldnt do this. i have to write the following code. this will be the last...
0
by: U S Contractors Offering Service A Non-profit | last post by:
Brilliant technology helping those most in need Inbox Reply U S Contractors Offering Service A Non-profit show details 10:37 pm (1 hour ago) Brilliant technology helping those most in need ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.