File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments