🔒 Closed C programming reverse

Status
Not open for further replies.

Phantom Rhythm

Honorary Poster
Pa help po paano gumawa ng test drive nito, gamit ang odd numbers and even numbers sa element ng array.

#include<stdio.h>

#define SIZE 5

int main(){

int array[SIZE]={1,2,3,4,5},i,j,temp;

for(i=0,j=SIZE-1;i<j;i++,j—){

temp=array;

array=array[j];

array[j]=temp;

}

printf(“Reverse array is:\n”);

for(i=0;i<SIZE;i++){

printf(“%d\n”,array);

}

}
 
Bubble sort po ang gusto mong gawin pero kulang pa po yung code. Pa try po dito You do not have permission to view the full content of this post. Log in or register now. then palitan mo lang yung elements ng array at size.
C:
#include<stdio.h>
int main(){
int size = 5;
int array[]={1,3,2,5,4};
for(int i = 0; i < size ; i++){
    for(int j = 0; j < size - 1; j++){
        if(array[j] > array[j+1]){
            int temp = array[j+1];
            array[j+1] = array[j];
            array[j] = temp;
        }
    }
}
printf("Reverse\n");
for(int l = size - 1; l >= 0; l--)
    printf("%d ", array[l]);
}
 
Status
Not open for further replies.

About this Thread

  • 2
    Replies
  • 404
    Views
  • 3
    Participants
Last reply from:
Arcturus

Trending Topics

Online now

Members online
962
Guests online
7,242
Total visitors
8,204

Forum statistics

Threads
2,354,384
Posts
29,383,453
Members
1,079,436
Latest member
Yes it is me
Back
Top