//Programme for revarse the content of array using pointer

//Programme for revarse the content of array using pointer
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
cout<<"enter first 10 no.\n";
int a[10],*p;
p=a;

for(int i=0;i<10;i++)
{
cin>>*(p+i);
}
cout<<"reverse content is of array is.\n";
int i,j;
for(i=0,j=10-1;i<=9/2;i++,j--)
{
int k=*(p+i);
*(p+i)=*(p+j);
*(p+j)=k;
}
for(i=0;i<10;i++)
{
cout<<*(p+i)<<endl;
}


}

No comments:

Post a Comment

programme for armstrong number for 3 digit in java

armstrong number import java.util.Scanner; class Mittu {     public static void main(String []args)     {         Scanner s=new Sca...