forked from sachin-nono/codingpractice
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInvertedTriangeRecursion.cpp
More file actions
63 lines (53 loc) · 926 Bytes
/
InvertedTriangeRecursion.cpp
File metadata and controls
63 lines (53 loc) · 926 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<<<<<<< HEAD:RECURSIO.CPP
/*WAP to print a pattern by recursion*/
//Enter what is asked and wait and dont press enter!!!
#include<iostream>
//#include"stdlib.h"
//#include"dos.h"
using namespace std;
=======
/*
WAP to print a inverted triange pattern by recursion
for ex. for n=3, pattern will be
* * *
* *
*
*/
#include<iostream>
#include<cstdlib>
#include<dos>
using namespace std;
>>>>>>> c700d35abf4555cbf59093ede5d46135a128dc5d:Inverted Triange using Recursion.cpp
int main()
{
void recursion(int);
int x;
cout<<"Enter no of rows:";
cin>>x;
recursion(x);
<<<<<<< HEAD:RECURSIO.CPP
return 0;
=======
return 0;;
>>>>>>> c700d35abf4555cbf59093ede5d46135a128dc5d:Inverted Triange using Recursion.cpp
}
void recursion(int x)
{
int y=x;
if(y!=0)
{
for(int i=x;i>0;i--)
cout<<"*"<<"\t ";
cout<<endl;
x--;
y--;
recursion(y);
}
else
{
//sleep(1);
cout<<"\nGood Bye!!!";
//sleep(1);
exit(0);
}
}