-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram101.java
More file actions
58 lines (44 loc) · 1.11 KB
/
Copy pathprogram101.java
File metadata and controls
58 lines (44 loc) · 1.11 KB
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
// Input : 4 4
/*
a a a a
B B B B
c c c c
D D D D
*/
import java.util.*;
class Pattern{
public void Display(int iRow ,int iCol)
{
int i = 0, j = 0;
char ch1 = '\0';
char ch2 = '\0';
for( i = 1 ,ch1 = 'a',ch2 = 'A'; i <= iRow ; i++,ch1++,ch2++)
{
for(j = 1 ; j<= iCol; j++)
{
if(i % 2 == 0)
{
System.out.print(ch2 +"\t");
}
else
{
System.out.print(ch1 +"\t");
}
}
System.out.println("\n");
}
}
}
public class program101 {
public static void main(String[] args) {
int iValue1 = 0;
int iValue2 = 0;
Scanner sobj = new Scanner(System.in);
System.out.println("Enter Number of Row :");
iValue1 = sobj.nextInt();
System.out.println("Enter Number of Columns :");
iValue2 = sobj.nextInt();
Pattern pobj = new Pattern();
pobj.Display(iValue1,iValue2);
}
}