C programming

Showing posts with label factorial without using recursive technique. Show all posts
Showing posts with label factorial without using recursive technique. Show all posts

Monday, June 13, 2016

c program to find factorial of a number without using recursive technique

#include<stdio.h>
#include<conio.h>
void main()
 {
  clrscr();
  int n,m,sum=1,a;
  printf("Enter a no");
  scanf("%d",&n);
//it will loop through the number and multiply all its small integers
  for(int i=1;i<=n;i++)
   {
    sum=sum*i;
   }
  printf("Factorial = %d",sum);
 getch();
}

output
Enter a no 6
720
Posted by Dinesh Agrawal at 8:11 AM No comments:
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Labels: C program, factorial, factorial without using recursive technique
Older Posts Home
Subscribe to: Posts (Atom)

About Me

My photo
Dinesh Agrawal
View my complete profile

Blog Archive

  • ▼  2016 (61)
    • ▼  June (9)
      • C program to understand the concept of initializat...
      • C program to make two matrix dynamically and show ...
      • C program to calculate GCD (greatest common diviso...
      • C program to save and retrieve records from extern...
      • c program to find factorial of a number without us...
      • C program to select elements from three given arra...
      • c++ program to show operation on time, add seconds...
      • C program to check given number in strong number o...
      • c program to count number of 1 in binary represent...
    • ►  May (14)
    • ►  April (15)
    • ►  March (23)
Simple theme. Theme images by fpm. Powered by Blogger.