A superb Pendulum array program
For other posts related to array click https://wordpress-343193-1101484.cloudwaysapps.com/array-programs-part-1-icse-computer-applications
It is an array where elements are stored in a pendulum pattern.
For other posts related to array click
Array in JAVA
• PENDULUM ARRAY:
import java.io.*;
class pendulumArray{
public static void main()throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter size of array");
int size=Integer.parseInt(br.readLine());
int arr[]=new int[size];
int end=size-1;
int front=0;
System.out.println("Enter the elements");
for(int i=0;i<size;i++){
if(i%2==0){
arr[end]=Integer.parseInt(br.readLine());
end--;
}
else{
arr[front]=Integer.parseInt(br.readLine());
front++;
}
}
for(int i=0;i<size;i++){
System.out.print(arr[i]+"\t");
}
}
}
INPUT: Enter size of array 5
Enter the elements 1 2 3 4 5
OUTPUT: 2 4 5 3 1INPUT: Enter size of array 5
Enter the elements 1 2 3 4 5
OUTPUT: 2 4 5 3 1
To watch videos related to core java
http://www. youtube.com/user/trushntej
Related Posts
Continue learning with these related articles

ISC Practical 2027: College Enrolment Code Validator and Stream Report – Algorithm and Java Program
Fully solved ISC Computer Science Practical 2027 question: validate college enrolment codes made of a stream, year and serial number, give the exact reason for each rejection, auto-correct lowercase streams and prepare a stream-wise report.

ISC Practical 2027: Digital Lock Security Code Analyzer – Algorithm and Java Program
Fully solved ISC Computer Science Practical 2027 number-logic question: for a 5 to 10 digit security code, find the first and last digits, odd and even position sums, product of non-zero digits, digit frequency and classify the code as STRONG, MODERATE or WEAK.

Boolean Algebra for ISC Class 12: Laws, Canonical SOP and POS, and Simplification
ISC Class 12 Computer Science notes on Boolean algebra: all the laws and theorems, duality, De Morgan's laws, minterms and maxterms, converting to canonical SOP and POS, and step-by-step algebraic simplification with solved examples.