File tree 3 files changed +101
-10
lines changed
3 files changed +101
-10
lines changed Original file line number Diff line number Diff line change
1
+ #include < iostream>
2
+ #include < math.h>
3
+ using namespace std ;
4
+
5
+ // bool checkPal(string str, int start, int end)
6
+ // {
7
+ // if (str[start] > str[end])
8
+ // {
9
+ // return 1;
10
+ // }
11
+ // if (str[start] != str[end])
12
+ // {
13
+ // return 0;
14
+ // }
15
+ // else
16
+ // return checkPal(str, start + 1, end - 1);
17
+ // }
18
+
19
+ int count (string str, int index)
20
+ {
21
+ if (index == -1 )
22
+ {
23
+ return 0 ;
24
+ }
25
+ if (str[index ] == ' a' || str[index ] == ' e' || str[index ] == ' i' || str[index ] == ' o' || str[index ] == ' u' )
26
+ {
27
+ return 1 + count (str, index - 1 );
28
+ }
29
+ else
30
+ {
31
+ return count (str, index - 1 );
32
+ }
33
+ }
34
+
35
+ int main ()
36
+ {
37
+ string name;
38
+ cout << " enter a number: " << endl;
39
+ cin >> name;
40
+
41
+ // cout << checkPal(name, 0, 4);
42
+ cout << count (name,4 );
43
+ }
Original file line number Diff line number Diff line change 1
- #include < iostream>
1
+ // #include<iostream>
2
+ // using namespace std;
3
+
4
+ // int main(){
5
+ // // string name;
6
+ // // cout<<"enter the name: ";
7
+ // // cin>>name;
8
+ // // cout<<"the name is : "<<name;
9
+
10
+ // string sentance;
11
+ // cout<<"enter data: ";
12
+ // getline(cin,sentance,'\n');
13
+ // cout<<sentance;
14
+ // }
15
+
16
+ #include < iostream>
2
17
using namespace std ;
3
18
4
- int main (){
5
- // string name;
6
- // cout<<"enter the name: ";
7
- // cin>>name;
8
- // cout<<"the name is : "<<name;
19
+ // int factorial(int n)
20
+ // {
21
+
22
+ // if (n == 0 || n == 1)
23
+ // return 1;
24
+
25
+ // return n * factorial(n - 1);
26
+ // }
27
+ // int fibo(int n)
28
+ // {
29
+ // if (n <= 1)
30
+ // {
31
+ // return n;
32
+ // }
33
+
34
+ // return fibo(n - 1) + fibo(n - 2);
35
+ // }
36
+ int gcd (int n1, int n2)
37
+ {
38
+ if (n2 == 0 )
39
+ {
40
+ return n1;
41
+ }
42
+ return gcd (n2, n1 % n2);
43
+ }
44
+ int main ()
45
+ {
46
+ // cout << "hello world!" << endl;
47
+ int num1, num2, ans;
48
+ // numbers from 1 to n;
49
+ cout << " enter number1: " << endl;
50
+ cin >> num1;
51
+ cout << " enter number2: " << endl;
52
+ cin >> num2;
53
+ // ans = factorial(num);
54
+ // cout << "The factorial of " << num << " is: " << ans;
55
+
56
+ // ans = fibo(num);
57
+ // cout << "The ans:" << " " << ans << endl;
58
+
59
+ ans = gcd (num1, num2);
9
60
10
- string sentance;
11
- cout<<" enter data: " ;
12
- getline (cin,sentance,' \n ' );
13
- cout<<sentance;
61
+ cout << " the Gcd is : " << ans << endl;
14
62
}
You can’t perform that action at this time.
0 commit comments