Read number(N)keyed in by user
Set factorial to 1
While N is not equal to 0
Set factorial=factorial*N
Set N= N-1
End While
Display factorial

what i have done is this:

String factorial;//declare variable factorial

factorial=1;
While N != 0
{
     factorial*N=factorial;
     N--;
}

DisplayLabel.Text=factorial.ToString

Edited 6 Years Ago by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

Where is the user input?
Why is factorial a string?
Why are you assigning an integer to a string?
That while statement won't compile.
The factorial assigment statement is incorrect.
The final statement will not compile.

Where is the user input?

Where is N defined, N is the input
Get the input from the user.

Why is factorial a string?

Make factorial an integer

Why are you assigning an integer to a string?

I think he was saying why are you assigning it as string where it should have been an integer

That while statement won't compile.

You need to add apprentices on your condition.

The factorial assigment statement is incorrect.

factorial*N=factorial; where did you learn programming man?
its factorial = ;

The final statement will not compile.

You are missing a ;

did you try to compile this?

I can see you are very new to programming. Which is OK, please tell me if you need further clarification.

thanks fpr helping and ya im very new to programming.just started 2 weeks ago.i need great help...im like cracking my head on how to programming the right way for certain applications right now.

Visual studio still does'nt run this program right.what is wrong with my code.what can i do to run the program well?

this is what i added in the coding:

    private void button1_Click(object sender, EventArgs e)
    {
   int factorial;
  factorial=1;

  While (N != 0);
  {
  factorial= factorial*N;

  N--;
  }
  factorialDisplay.Text = factorial.ToString;

Edited 3 Years Ago by mike_2000_17: Fixed formatting

Where is your input?

you haven't initialized N.

factorialDisplay.Text = factorial.ToString();

What is the Error. If you read it you should be able to tell.

Where is your input?

you haven't initialized N.

factorialDisplay.Text = factorial.ToString();

What is the Error. If you read it you should be able to tell.

is it supposed to be
factorialDisplayLabel.Text=Convert.ToInt();

This article has been dead for over six months. Start a new discussion instead.