0% found this document useful (0 votes)
8 views5 pages

Single Array

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views5 pages

Single Array

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

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 java.util”;

public class SingleArray {

public static void main(String args[]) {

Scanner s = new Scanner (System.in);

int input[] = new int [10];

for (int i=0; i (inputLength; i++) {

System.out.println(“Enter number for 2(“++”): “);

Input[1] = 6,nextln();

System.out.println(“The 6th Element; “+input[6]);

}
2. int m;

int osum = 0;

int esum = 0;

Scanner s = new Scanner(System.in);

int x[] = new int[10];

System.out.println(“Enter all the elements:”);

For (int i = 0; i ( 10; i++)

{
x[1] =snextln():

System.out.print(“Odd numbers:”);

If(x[1] % 2 I= 0)

Osum = osum = x[1];

}
}
System.out.print(“ “+osum);

System.out.println(“”);

System.out.print(“Even numbers:”);

for(int i = 0 : i ( 10 ; i++)

if (x[1] % 2 == 0)

{ esum = esum + x[1];

System.out.print(“ “ +esum);

}
}
import javautil”;
public class SingleArray {
public static void main (String args[]) {
Scanner scanner = new scanner(System.in);
ArrayList(String) arr = new ArrayList<String>();

int b;

for(int i = 0; true; i++) {

System.out.println(“Enter Number: “);

b = scanner.next.int();
break;
} else {
a+odd(Integer.to.string<b>);

}
}
System.out.println(a++);
}
}

You might also like