-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlec2.cpp
75 lines (66 loc) Β· 1.11 KB
/
lec2.cpp
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include<iostream>
using namespace std;
// // two parameters
// void print1toN(int num , int N){
// if(num == N){
// cout<<N;
// return ;
// }
// cout<<N<<endl;
// print1toN(num +1, N);
// }
// void print1toN(int n )
// {
// if(n == 0)
// {
// return ;
// }
// print1toN(n-1);
// cout<<n<<endl;
// }
// void print10toN(int n )
// {
// if(n == 10)
// {
// cout<<n<<endl;
// return ;
// }
// print10toN(n-1);
// cout<<n<<endl;
//}
// void printEven(int n)
// {
// if(n == 2)
// {
// cout<<n;
// return;
// }
// printEven(n-2);
// cout<<n<<endl;
// }
void tableN(int num,int n = 11 )
{
if(n ==1)
{
return ;
}
tableN(num,n-1);
cout<<num<<" * "<<n-1<<" = "<<num*(n-1)<<endl;
}
int main()
{
// // two parameters
// print1toN(1,5);
// //one parameter only
// print1toN(10);
// //even number
// int N = 11;
// if(N%2!=0) N--;
// printEven(11);
// //hw
// //n>10
// print10toN(11);
//table of n
tableN(2);
return 0 ;
}