-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathPattern7.js
More file actions
67 lines (61 loc) · 886 Bytes
/
Pattern7.js
File metadata and controls
67 lines (61 loc) · 886 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
64
65
66
67
/*
* *
** **
*** ***
*******
*** ***
** **
* *
*/
let n=7
if(n%2!=0){
let mid=parseInt(n/2);
let star=1;
let space=n-2;
for(let i=0;i<mid;i++)
{
for(let j=0;j<star;j++)
{
process.stdout.write("*");
}
for(let j=0;j<space;j++)
{
process.stdout.write(" ");
}
for(let j=0;j<star;j++)
{
process.stdout.write("*");
}
star++;
space=space-2;
console.log();
}
for(let i=0;i<n;i++)
{
process.stdout.write("*");
}
console.log();
star=star-1;
space=1;
for(let i=0;i<mid;i++)
{
for(let j=0;j<star;j++)
{
process.stdout.write("*");
}
for(let j=0;j<space;j++)
{
process.stdout.write(" ");
}
for(let j=0;j<star;j++)
{
process.stdout.write("*");
}
star--;
space=space+2;
console.log();
}
}
else{
console.log("Enter an odd Number");
}