bsc

Comprehensive codebase and cou...
Log | Files | Refs | Activity | README | LICENSE

root / semester_2 / practice / prac_006.cpp

prac_006.cpp (479B)


      1 /* factorial */
      2 
      3 #include <iostream>
      4 using namespace std;
      5 
      6 class fact {
      7     int inp, a, i;
      8 
      9 public:
     10     void input();
     11     void calc();
     12     void diplay();
     13 };
     14 
     15 void fact::input() {
     16     cout << "enter the number :";
     17     cin >> inp;
     18     a = inp;
     19 }
     20 
     21 void fact::calc() {
     22     for (i = 1; i <= inp - 1; i++) {
     23         a = a * i;
     24     }
     25 }
     26 
     27 void fact::diplay() {
     28     cout << "Factorial " << a << ".";
     29 }
     30 
     31 int main() {
     32     fact z;
     33     z.input();
     34     z.calc();
     35     z.diplay();
     36     return 0;
     37 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror