Programs in C

Monday, 17 August 2015

To find factorial of number

#include <stdio.h>
 
int main()
{
  int c, n, fact = 1;
 
  printf("Enter a number to calculate it's factorial\n");
  scanf("%d", &n);
 
  for (c = 1; c <= n; c++)
    fact = fact * c;
 
  printf("Factorial of %d = %d\n", n, fact);
 
  return 0;
}
Posted by Unknown at 09:34
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Blog Archive

  • ▼  2015 (16)
    • ▼  August (16)
      • Program to find roots of quadratic equation using ...
      • To perform Arithmetic Operations Using Switch case
      • To find fibonacci series
      • To find factorial of number
      • To find Sum of square program
      • To find the sum and average of n elements given by...
      • To Check Whether a Number is Positive or Negative
      • To check given number is even or odd
      • To find Largest of Two Numbers using Conditional O...
      • Find greatest of 3 number using conditional operator
      • To find greatest number from two numbers using if ...
      • To find the largest of three numbers using if else
      • To Check given number is Prime Number or Not
      • Print prime number from 0 to n number
      • Convert Celsius to Fahrenheit
      • Convert Fahrenheit to Celsius

Popular Posts

Simple theme. Powered by Blogger.