Factorial

  • October 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Factorial as PDF for free.

More details

  • Words: 116
  • Pages: 2
/*format agency fb bold 14*/ /*program to find the factorial of a number using recursions*/ #include<stdio.h> #include void main() { int n,f; int fact(int); clrscr(0; printf("enter the number to find the factorial:"); scanf("%d",&n); f=fact(n); printf("\nthe factorial of the given number is %d",f); getch(); } int fact(int n) { int f; f=n*fact(n-1); return f; } //program to find factorial using classes #include #include class factorial { private: int facto,i; public: void setvalue() { facto=1; } int fact(int); }; int factorial::fact(int n) { for(i=1;i<=n;i++) { facto=facto*i; } return facto; } void main() { int n; fcatorial f; f.setvalue(); cout<<"enter the number to find factorial:"; cin>>n; cout<<"the factorial of the given number is "<
getch(); } thank you vinaychalluru

Related Documents

Factorial
June 2020 13
Factorial
October 2019 24
Funcion Factorial
April 2020 16
Million Factorial
May 2020 27
Analisis Factorial
June 2020 12
Factorial Designs
May 2020 34