-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPerp.java
More file actions
34 lines (34 loc) · 1.05 KB
/
Perp.java
File metadata and controls
34 lines (34 loc) · 1.05 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
import java.util.Scanner;
public class Perp {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter Number of Team: ");
int n = sc.nextInt();
sc.nextLine();
if(n<2||n>9){
System.out.println("Inavalid Number of Teams!");
System.exit(0);
}else{
String team[] = new String[n];
int max=0;
for(int i =0;i<n;i++){
System.out.print("Enter Team "+(i+1)+": ");
team[i]=sc.nextLine();
if(team[i].length()>max){
max=team[i].length();
}
}
for(int i=0;i<max;i++){
for(int j = 0;j<n;j++){
if(team[j].length()<=i){
System.out.print(" :");
}else{
System.out.print(" "+team[j].charAt(i)+" :");
}
}
System.out.println();
}
}
sc.close();
}
}