factorial of a number by using array within structure.cpp

Factorial of a number by using array within the structure in C++.

Source code of Factorial of a number by using array within the structure in C++

Following concepts are used in this program

  • structure = For example “factorial”.
  • array within the structure= For example “struct factorial { int num[2]; }; “.
  • for loop = For example;
    • for(int i=0;i<=1;i++)
    • for( int j=1;j<=fac.num[i];j++)

Output

Enter a number:

7

factorial of a number is= 5040

Enter a number:

Latest posts by Prof. Fazal Rehman Shamil (see all)

Buy advertisement space on T4Tutorials

For more details email [email protected]