-
Notifications
You must be signed in to change notification settings - Fork 98
Expand file tree
/
Copy pathN.java
More file actions
32 lines (19 loc) · 972 Bytes
/
Copy pathN.java
File metadata and controls
32 lines (19 loc) · 972 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
// Write a program to print letter N exactly
class N{
public static void main(String args[]){
for(int x=0;x<8;x++){ // to iterate from top to bottom
for(int y=0;y<13;y++){ // to iterate from left to right in the same row
if(y==1 || y==0 || y==11 || y==12){
System.out.print("#"); // to print hash wherever necessary
}
else if(y-x==2 || y-x==3){
System.out.print("@"); // to print @ wherever necessary
}
else{
System.out.print(" "); // to print space wherever necessary
}
}
System.out.println();
}
}
}