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

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy