Write a program to delete a particular element from the specified location from an array
Answers
Answered by
0
import java.util.*;
class delete
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int a[]=new int[10];
System.out.println("Enter an array of 10 elements");
for(int i=0;i<10;i++)
a[i]=sc.nextInt();
System.out.println("Which position will I delete?");
int n=sc.nextInt();
System.out.println("Here is the new array :");
for(int i=0;i<n;i++)
System.out.println(a[i]);
for(int i=n;i<10;i++)
System.out.println(a[i]);
}
}
Similar questions
Math,
7 months ago
Math,
7 months ago
English,
7 months ago
Computer Science,
1 year ago
Computer Science,
1 year ago
English,
1 year ago