Skip to main content

Featured

functions in Python

C program to reverse an int array

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int arr[10];int i,j,temp;
for(i=0;i<10;i++)
{
cout<<"\nEnter No."<<i+1<<"\n";
cin>>arr[i];

}
cout<<"You Entered \n";
for(i=0;i<10;i++)
{
cout<<arr[i]<<"\t";
}

for(i=0,j=9;i<10/2;i++,j--)
{
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
cout<<"Now Reversed Array \n";
for(i=0;i<10;i++)
{
cout<<arr[i]<<"\t";
}

getch();
}
OUTPUT:

Comments

Popular Posts