-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCODE12.cpp
More file actions
48 lines (44 loc) · 1.68 KB
/
CODE12.cpp
File metadata and controls
48 lines (44 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// #include<iostream>
// using namespace std; //LEARNING RECURSION
// int fact(int a) //RECURSION MEANING WHEN VALUE SATISFY 0 OR 1 IN DECRIMENT ORDER
// { //CALL RECURTION EX-9,8,7,6,5,4,3,2,1 THIS IS RECURSION
// switch (a)
// {
// case 1:
// /* code */
// return 1;
// break;
// default:
// break;
// }
// return a *fact(a-1);
// }
// int main()
// {
// int a =4;
// cout<<fact(a);
// return 0;
// }
#include<iostream>
using namespace std;
void fact(int);
// FACTORIAL WITH ALL NUMBER
int main()
{
int fact_in;
cout<<"enter an number"<<endl<<"=";
cin>>fact_in;
fact(fact_in);
return 0;
}
void fact(int fact_in)
{
int pno_in=1; //??I NEED TO GIVE A NUMBER // int i=a;
for (fact_in; fact_in>1; fact_in--)
{
/* code */
cout<<fact_in<<" * ";
pno_in=pno_in*fact_in;
}
cout<<1<<"="<<pno_in;
}