Page 266 - computer science (868) class 11
P. 266
8 System.out.println("Enter the value of n");
9 n=sc.nextInt();
10 String name[ ]=new String[n];
11 char sec[ ]=new char[n];
12 int roll[ ]=new int[n];
13 int i;
14 for(i=0; i<n; i++)
15 {
16 System.out.println("Enter the name, section and roll number of the
student");
17 name[i]=sc.next();
18 sec[i]=sc.next().charAt(0);
19 roll[i]=sc.nextInt();
20 }
21 System.out.println("--------------------------------");
22 System.out.println("Name\tSection\tRoll Number");
23 for(i=0;i<n;i++)
24 {
25 System.out.println(name[i]+"\t"+sec[i]+"\t"+roll[i]);
26 }
27 }
28 }
The output of the preceding program is as follows:
Enter the value of n:
2
Enter the name, section and roll number of the student
Amit
A
1
Enter the name, section and roll number of the student
Lalit
B
2
--------------------------------
Name Section Roll Number
Amit A 1
Lalit B 2
264264 Touchpad Computer Science-XI

