Name: Jeriel Antipuesto Yara Date:November 16 2020
Yr and Section: Bs-infotech 2-C
1. Write a program to input 10 characters and display the 6th
element,import [Link]”;
public class SingleArray {
public static void main(String args[]) {
Scanner s = new Scanner ([Link]);
int input[] = new int [10];
for (int i=0; i (inputLength; i++) {
[Link](“Enter number for 2(“++”): “);
Input[1] = 6,nextln();
[Link](“The 6th Element; “+input[6]);
}
2. int m;
int osum = 0;
int esum = 0;
Scanner s = new Scanner([Link]);
int x[] = new int[10];
[Link](“Enter all the elements:”);
For (int i = 0; i ( 10; i++)
{
x[1] =snextln():
[Link](“Odd numbers:”);
If(x[1] % 2 I= 0)
Osum = osum = x[1];
}
}
[Link](“ “+osum);
[Link](“”);
[Link](“Even numbers:”);
for(int i = 0 : i ( 10 ; i++)
if (x[1] % 2 == 0)
{ esum = esum + x[1];
[Link](“ “ +esum);
}
}
import javautil”;
public class SingleArray {
public static void main (String args[]) {
Scanner scanner = new scanner([Link]);
ArrayList(String) arr = new ArrayList<String>();
int b;
for(int i = 0; true; i++) {
[Link](“Enter Number: “);
b = [Link]();
break;
} else {
a+odd([Link]<b>);
}
}
[Link](a++);
}
}