C program to find the factorial of a number using non-recursive function

64

By rakhi143

What is factorial of a number?

Factorial of a number is nothing but the result of the multiplication of the numbers before it. For instance factorial of 4 is 1*2*3*4=24

Program for factorial of anumber using non recursive function

/* By RAKESH AKUTHOTA */

#include<stdio.h>

#include<conio.h>

void main()

{

int n,f;

clrscr();

printf("enter a number");

scanf("%d",&n);

f=factorial(n);

printf("the factorial of the number %d is %d",n,f);

getch();

}

int factorial(int num)

{

int fact=1,i;

{

for(i=1;i<=num;i++)

{

fact=(fact*i);

}

}

return(fact);

}

Recommended books

C: How to Program (6th Edition)
Amazon Price: $49.99
List Price: $140.00
Effective C++: 55 Specific Ways to Improve Your Programs and Designs (3rd Edition)
Amazon Price: $31.99
List Price: $49.99
Objective-C Programming: The Big Nerd Ranch Guide (Big Nerd Ranch Guides)
Amazon Price: $20.00
List Price: $39.99
Problem Solving and Program Design in C (6th Edition)
Amazon Price: $39.00
List Price: $127.00
C Programming Language (2nd Edition)
Amazon Price: $37.80
List Price: $67.00
C Program Design for Engineers (2nd Edition)
Amazon Price: $94.32
List Price: $118.00

About me

I am Rakesh Kumar Akuthota studying B.tech (IT) first year at Sree Dattha Institue Of Engineering And Science, Ibrahimpatnam, Hyderabade, Andhra Pradesh, India. I have made these posts in order to help some or the other who are interested in learning c language and at the same time to make some money online inorder to satisfy me dreams of doing an MBA from London or Australia. I love making friends online. If you want me to be a friend of yours then please do send a request at facebook. I also blog at flixya and dollardreams and 14sms

I really want to get your suggestions in the form of comments and they will boost me up. Please leave your valuable fedback and suggestion in the form of comments.

Click edit above to add content to this empty capsule.

Comments

No comments yet.

Submit a Comment
Members and Guests

Sign in or sign up and post using a hubpages account.



    • No HTML is allowed in comments, but URLs will be hyperlinked
    • Comments are not for promoting your Hubs or other sites

    Please wait working