Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ClassTheory;
- import java.util.Scanner;
- public class Fahim {
- public static void main(String[] args) {
- Scanner ss = new Scanner(System.in);
- System.out.println("Enter how many element you want you in array");
- int n=ss.nextInt();
- int[] a=new int[n];
- for (int i = 0; i <n; i++) {
- a[i]=ss.nextInt();
- }
- System.out.println("Enter the index of element which you want to delete");
- int d=ss.nextInt();
- a[d]=0;
- for (int i = 0; i < n; i++) {
- if(a[i]==0){
- continue;
- }else{
- System.out.print(a[i]+" ");
- }
- }
- System.out.println("");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement