1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Factorial program

Discussion in 'C#' started by flmeendee@gmail.com, Apr 8, 2011.

  1. flmeendee@gmail.com

    flmeendee@gmail.com New Member

    Joined:
    Apr 8, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    student
    Location:
    Zimbabwe
    I am looking for a C # code for the factorial program
     
  2. guria

    guria New Member

    Joined:
    Apr 7, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    karachi,pakistan
    (BY THE HELP OF WHILE LOOP USING FACTORIAL)
    Code:
    #include<stdio.h>
    #include<conio.h>
    void main(void)
    {
    int num,num b,factorial;
    clrscr();
    printf("enter number\n");
    scanf("%d",num);
    factorial=1;
    num b=1;
    while(num b<=num)
    {
    factorial=factorial*num b;
    num b++;
    }
    printf("\n the factorial of %d=%d",num,factorial);
    getch();
    }
     

Share This Page