# Factorial Calculation Using .net?

Dec 15, 2011Develop an application which reads two integers n1 and n2 from the user via two textboxes and displays in a label the sum of the factorial of the integers n1 and n2?

Develop an application which reads two integers n1 and n2 from the user via two textboxes and displays in a label the sum of the factorial of the integers n1 and n2?

This is a math calculation which is using factorial.

[Code]...

I need to store a calculation to use later and obtain a new calculation

[Code]...

how to find factorial

View 1 Replies View Relatedcan you write an algorithm which can calculate 500 factorial.scientific symbol(mode) is unauthorized.Answer should be in String mode.

View 1 Replies View RelatedTrying to figure out how to calculate factorials via loops. Cant seem to figure out where to start when using loops.

View 9 Replies View RelatedNeed to take the number from a textbox and get the factorial

Public Class Form1

Private Sub btnCalculate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCalculate.Click

[Code]....

Imports System.Numerics 'have to add reference Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

[Code]...

calculate the factorial of given number using recursion.input the number in textbox and show the

result in another textboxrajeev ranjan, on 29 March 2010 - 12:38 PM, said:calculate the factorial of

given number using recursion.input the number in textbox and show the result in another textbox.

So I need to get a button to take the number that a user enters into a textbox, calculate the factorial from that number, and display it in another textbox. I can't seem to get this to come out right.

Here's some of the code I've been playing with.

Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click

Function Factorial(ByVal txtFactorial As Decimal) As Decimal

If txtFactorial <= 1 Then

MessageBox.Show("Enter a number greater than 1")

Else

txtAnswer = Factorial(txtfactorial - 1)

End If

End Function

Now I have to just work out the code part. Can a function be under a button? I'm getting an error about that. I'm also getting an error about the txtAnswer=Factorial(txtfactorial-1) part of the code.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click.[code]the program enters a number and display its factorial, our program has error, eg. if your going to input 7, the result would be {num1}5040.we are having difficulty in its result... the required output should be 1*2*3*4*5*6*7=5040

View 1 Replies View RelatedCan someone explain to me what the difference is between a recursive function and a factorial function. I know that a factorial function returns the product of all the numbers from 1 to itself. But how does that differ from what a recursive function does

View 2 Replies View RelatedHeres my code in vb 2008[code]...

I need to add 15% vat to it and i have no clue how to add the 15% vat.

compute an exact age of a person using the format date of mm/dd/yy... in vb.net, i was trying to code it but the result was not the exact age of the person.lp me...

View 11 Replies View RelatedI am using Microsoft Visual Studio 2008 with VB.NET, and in class we were assigned this project: A procedure should calculate a 2% price increase on all red shirts, but a 1% price increase on all other items. In addition to calculating the price increase, the procedure also should calculate the new price. You can use the variables strItemColr, strItem, decOrigPrice, decIncrease, and decNewPrice. Format the original price, price increase, and new price in the lblOriginal, lblIncrease, and lblNewPrice controls, respectively.

View 1 Replies View RelatedI have datagridview, wich have 5 columns

example:

id supplier bought payed sum

1 a 15

2

2 a 20

[Code].....

i have an issue with my program. when i create a function and use a calculation in it it returns a wrong answer. if i copy the calculation and put it directly in the btnClick event it works ok. is this normal?

here is the code if you would like to try see what i am doing wrong.

Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click

[code].....

I'm having trouble with a calculation in VB and it's a simple one but for some reason I keep getting an output of zero.

Here's the code for the calculation and the click button:

CODE:

i have this problem on how to calculate the amount due in our system in VISUAL BASIC.NET .in returning module, (this is for penalty purposes), if the borrower didn't return the book on time, the system must automatically generate the amount due .one daY is equivalent to 10(ten) pesos.so if the borrower didn't return the book with 2 days. the amount due must be 20.00 pesos.

View 6 Replies View RelatedI have two money fields in a SQL database called TotalClaimed and PartialSettlementAmountRecd.They are declared as Decimals like so:

Public PartialSettlementAmountRecd As Decimal

Public TotalClaimed As Decimal

They both output the repsective amounts perfectly. I need to do a calculation on them, by subtracting PartialSettlementAmountRecd from TotalClaimed. I have tried the following, but it just outputs a random number, not the amount I require.

Dim NewSettAmount As Decimal = (ClaimDetail.TotalClaimed) - (ClaimDetail.PartialSettlementAmountRecd)

Response.Write("New Settlement Amount: £" & NewSettAmount)

I found this thread in regards to calculating CRC16 on an array.... however, it does not work probably because it was written for VB6 and not .NET. [URL] Does anyone know of a built-in function in .NET to calculate CRC16? If not, is there a way I can adapt the above VB code example to work with Visual Studio 2010?

View 12 Replies View Relatedwhat i am trying to do is i have two textboxs which have figues in them and need the 3rd textbox to display the figure the code i am using doesnt seem to be doing anything could anyone spot it and tell me why it is not working for me

[Code]...

i am trying to do is i have two textboxs which have figues in them and need the 3rd textbox to display the figure the code.[code]I want the answer doesnt display in the textbox as i want it but when i click on the text box nd type anything the answer shows but in the error

View 6 Replies View RelatedI'm writing a financial calculator. I know that my calculations are more precise when Decimal format is used. But when I calculate 314/365, the answer given by VB is 0.8602814581, where as the real answer is 0.8602739726. This ends up affecting my calculations quite a bit.

View 7 Replies View RelatedI am trying to perform a simple multiplication in vb.

Below is my code:

Dim minus As Integer

Dim minusPrice As Integer

Dim totalPrice As Integer

[Code].....

I have an array of characters. Depending on the number selected (between 1 and 30), the program selects random characters and concatonates them into a string. Kind of like how I think a password generator would work.I want to update a progress bar to show how the operation is going, but I need to reserve 20% of the progress bar for some actions before this, and the last 10% for the actions that follow it. So there is 70% available to use. My question is:If I set the progress bar to 20% and do the following math: 70/NumOfChars, then use a for loop to add the result of this to the progress bar (pb+=result), why does the total progress NOT EQUAL 90%!

View 1 Replies View RelatedI am trying to figure out how to take what the user selects in the up down menu and use it in my calculation.

View 2 Replies View RelatedI made a calculator but I want to use only one time a comma (,) and after I put for example a minus(-) sign, it will enable the comma again.

View 6 Replies View RelatedI'm trying to work on code where I enter number of hours into a textbox (txtHours) and then EITHER you press a button (cmdPay) and then the income for the week is calculated and shows up in a second text box (txtPay) OR txtPay does the calculation itself, everytime a number is typed into txtHours.

Currently, my code is trying to do the former, because I have NO idea how to even approach the second option.My problem I am having with my code, is I don't know how to properly dim my parameters, since my "button_click" code keeps coming up with this error:Argument not specified for parameter...

Public Function PayTotal(ByVal cnthours As Double, ByVal standpay As Double, ByVal overpay As Double) As Double

cnthours = CDbl(txtHours.Text)

[code]....

got a project from college to create a quotation system in console application for a car company. The program has to tell the customer how much interest they'll be charged and the loan they take out.I've created a file that Adds,deletes,edits customer. Also views all customers. The problem I have is that after I've added the customer. I need to now implement the calculations into my program to then give them the quote. Also need to add a password to the program.

View 6 Replies View RelatedI have a 2d array and I want to do a calculation on each element in the array and then return the index which results in the smallest value.

I have tried iterating through each element in the 2d array and running the calculation. If the calculated result is smaller than the currently stored minimum I set that to the minimum.

This works but it runs so slowly it makes the solution a non starter. It performs each calculation quickly but because of the number of elements in the array the calculation for the whole array is stupidly long.

I am trying to work with taking in and parsing CSV files. Right now I have it taking in and producing something like this:

The program loads the csv and copies the data into an array as such:

ReDim strarray(num_rows, num_cols)

For x = 0 To num_rows

strline = strlines(x).Split(",")

[Code]....

etc. I guess my main problem is trying to perform calculations to all values in a specific column. To start I am just trying to figure out how to isolate the columns and found that by using MsgBox(strarray(x, num_cols)) it will msgbox everything in the second column twice. I just want to try and understand how I can perform a basic calculation like multiply every value in the first column by 2 and every value in the second column one by 3.

I have a Grid With Text Item Templates to insert data from Grid to Database.I have to make some formula on runtime with out postback the page Can i do this My code is bellow.

For Each gvRow2 As GridViewRow In GridView1.Rows

Dim txtNetWt As TextBox = CType(gvRow2.FindControl("txtNetWt"), TextBox)

Dim txtGrossWt As TextBox = CType(gvRow2.FindControl("txtGrossWt"), TextBox)

[Code]....

Im creating a slot machine that costs 10 credits to use but i cant get it so that i can -10 credits from the total.

Heres my entire code:

Public Class frmFruitMachine

Dim OneCredit As Integer = 1

Dim FiveCredit As Integer = 5

[CODE].........................................

In my form I have a text box for user to enter the number of column and row. And I also have a text box to enter the first X value and Y value. Now what I want to do is if user enter 2 for row and 10 for column then now I will have two rows with 10 column. The X value is for column and Y value is for row.

It will look like this

**********

**********

When the user enter the first X and Y value. For next X and Y value i must plus the original value with 2.54.

So my X1=TextBox1.Text

Y1=TextBox2.text

this values are input by user.

So

X2=TextBox1.text + 2.54

X3=X2 + 2.54.

and so onn. Same apply for Y

Let say user input are X=100 and Y=100

The value for first * is X= 100 and Y=100

Second *X=102.54 and Y= 100............. and so on

For 11th * X=10th *value + 2.54 Y= 100+2.54 and so on

The row and column is not same always it depends on user..

I wish to calculate the relative humidity with 3 known params which are: moisture(Absolute Moisture Content (AMC) in g/kg dry air), AirTemp(in degree c) and AirPressure(in kpa).

View 1 Replies View Relatedallow the user to enter a stock transaction and determine the stockbroker's commission. Each transaction includes the following data: the stock name, price per share, number of shares involved, and the stock broker's name. Assume price per share = P. The stockbroker's commission is computed in the following manner: If the P (price per share) is less than or equal to $50, the commission rate is $0.19 per share, if P is greater than $50, thecommission rate is $0.26 per share. If the number of shares sold is less than 150, the commission is 1.5 times the rate per share. Display the results in a message box, including the total commission earned.

View 2 Replies View RelatedIm a little stuck with the Compound Interest Formula.

My code returns

0.00 :L

Dim amount, interest, monthly As Double

[code].....

Fist off, I am new at this and only learning it for a class. We have a program to create using Visual Studio 2008. The teacher doesn't give us much to go by so I really have no idea where to even start so any code will be a great help. Here is what i have to create:Your project will allow the user to enter a stock transaction and determine the stockbroker's commission. Each transaction includes the following data: the stock name, pricer per share, number of shares involved, and the stock broker's name. Assume price per share = P. The stockbroker's commission is computed in the following manner: If the P (price per share) is less than or equal to $50, the commission rate is $0.19 per share, if P is greater than $50, the commission rate is $0.26 per share.

View 1 Replies View RelatedI have a program to make for a class i am in and i am stuck on this one part, its a form application where you have to enter the first and last name of five students along with their final grade then you click a submit button after each one and i need it so that after all five buttons are clicked it activates the summarize button and i can't figure out how to do that and another thing when you hit the summarize button it has to compare the grade against the value of a text box containing the pass threshold to amount how many passed or failed.

View 1 Replies View RelatedI have a real problem for the last 2 days.I have a date stored in my MS Access DB as "ShortDate" (dd/MM/yyyy).I need to read this date and compare it with "current date - X days". Where X days is a Value saved by the user (into another form 5, 30, 60 days... etc).If "Current Date - 55 Days" it's equal OR in that interval of "DataBase Date" then MessageBox.Show("Warning!!! Expiring in {X} Days")ElseIf "Current Date - 55 Days" it's greater than "DataBase Date" MessageBox.Show("It's expired.")[code]

View 7 Replies View RelatedI have the following code to manipulate the points in a path before drawing it.

Private Function CurvePath(ByVal inputPath As GraphicsPath) As GraphicsPath

Dim tmpPath As New GraphicsPath

Dim newPath As New GraphicsPath

[code].....

I have here a huge csv file with millions of rows entries. I want to load this data in a vb.net application, what datatype should i use, datatable, array or sth. else? It needs to be as fast as possible. how i can optimize the loading of the data? I once loaded this data in a datatable and it took days.. then i exportet it as xml data and loaded this xml file with the data. this was about thousand times faster.

View 5 Replies View RelatedI just need help with my Pizza Program in calculations. It keeps on adding on top of the original calculations. I did try to set the variables to 0, but that really didn't work out since the price that is shown turns out to be 0.

View 1 Replies View RelatedI puzzle with (setting uptime-real time clock) calculation.ex. if I want my stopwatch countdown fromtart: 18.20.30 - stop: 18.50.50 = difference time is 00.30.20 that is easy butstart: 18.20.30- stop: 18.50.40 = difference time is 00.30.40

View 10 Replies View RelatedADVERTISEMENT