-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunction.cpp
More file actions
46 lines (40 loc) · 830 Bytes
/
Copy pathFunction.cpp
File metadata and controls
46 lines (40 loc) · 830 Bytes
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
#include<iostream>
using namespace std;
//Factorial
// int fact(int n){
// int fact = 1;
// for (int i = 1; i <= n; i++){
// fact *= i;
// }
// return fact;
// }
// int main(){
// cout<<fact(5)<<endl;
// cout<<fact(10)<<endl;
// return 0;
//}
//Pass by value
// void changeX(int x){
// x = 2*x;
// cout<<"x ="<<x<<endl;
// }
// int main(){
// int x = 5;
// changeX(x);
// cout<<"x ="<<x<<endl;
// return 0;
// }
//Que: Sum of digits
// int sumDigit(int num){
// int digSum = 0;
// while(num > 0){
// int lastDig = num % 10;
// num /= 10;
// digSum += lastDig;
// }
// return digSum;
// }
// int main(){
// cout<<"Sum of Digits ="<<sumDigit(145)<<endl;
// return 0;
// }