Skip to content

Commit 387313e

Browse files
authored
Merge pull request #33 from aarush2410/main
left triangle
2 parents a12b2f3 + cf3ead0 commit 387313e

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

ascii.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
public class PrintAsciiValueExample1
2+
{
3+
public static void main(String[] args)
4+
{
5+
// character whose ASCII value to be found
6+
char ch1 = 'a';
7+
char ch2 = 'b';
8+
// variable that stores the integer value of the character
9+
int asciivalue1 = ch1;
10+
int asciivalue2 = ch2;
11+
System.out.println("The ASCII value of " + ch1 + " is: " + asciivalue1);
12+
System.out.println("The ASCII value of " + ch2 + " is: " + asciivalue2);
13+
}
14+
}

left triangle.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
public class RightTrianglePattern
2+
{
3+
public static void main(String args[])
4+
{
5+
//i for rows and j for columns
6+
//row denotes the number of rows you want to print
7+
int i, j, row=6;
8+
//outer loop for rows
9+
for(i=0; i<row; i++)
10+
{
11+
//inner loop for columns
12+
for(j=0; j<=i; j++)
13+
{
14+
//prints stars
15+
System.out.print("* ");
16+
}
17+
//throws the cursor in a new line after printing each line
18+
System.out.println();
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)