forked from nivedha-ravi/Code-and-Compile
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathASCII diagonal pattern.java
More file actions
50 lines (49 loc) · 998 Bytes
/
ASCII diagonal pattern.java
File metadata and controls
50 lines (49 loc) · 998 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
/*
INPUT:
mark
OUTPUT:
********109
******97***
***114*****
107********
INPUT:
skillrack
OUTPUT:
**********************115
*******************107***
****************105******
*************108*********
**********108************
*******114***************
*****97******************
***99********************
107**********************
*/
import java.util.*;
public class Hello {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
StringBuilder sb=new StringBuilder(in.nextLine());
String s=sb.reverse().toString();
for(int i=s.length()-1;i>=0;i--)
{
for(int j=0;j<s.length();j++)
{
if(i==j)
{
int ch=(int)s.charAt(j);
System.out.print(ch);
}
else
{
String len=((int)s.charAt(j))+"";
for(int k=0;k<len.length();k++)
{
System.out.print("*");
}
}
}
System.out.println();
}
}
}