Reverse the order of number and print
int main(){
int arr[10] ={1,2,3,4,5,6,7,8,9,10};
int front,rear,temp;
front = 0;
rear =9;
while(front<rear){
temp = arr[front];
arr[front] = arr[rear];
arr[rear] =temp;
front++;
rear--; }
int i;
for (i =0;i<10;i++){
printf("\n%d",arr[i]);
}
return 0;
int arr[10] ={1,2,3,4,5,6,7,8,9,10};
int front,rear,temp;
front = 0;
rear =9;
while(front<rear){
temp = arr[front];
arr[front] = arr[rear];
arr[rear] =temp;
front++;
rear--; }
int i;
for (i =0;i<10;i++){
printf("\n%d",arr[i]);
}
return 0;
}
Comments
Post a Comment