Computer Science, asked by MG45, 9 months ago

Write a program to accept array elements and print them in reverse order using pointer.​

Answers

Answered by salehu23
0

importjava.util.*;

class hi

{

public void main ()

{

Scanner sc=new Scanner(System.in);

int m[ ]=new int[ ];

int i,a,rev=0,d;

System.out.println("enter the length of array");

a=sc.nextInt();

System.out.println("enter the elements in the array");

for(i=0;i<a;i++)

{

m[i]=sc.nextInt();

}

while (n>0)

{

d= n%10;

rev=rev*10+d;

n/=10;

}

System.out.println("Reverse of the number="+rev);

}

}

Similar questions