๐Ÿ”’ 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
  • 380
    Views
  • 3
    Participants
Last reply from:
Arcturus

Online now

Members online
1,089
Guests online
2,224
Total visitors
3,313

Forum statistics

Threads
2,277,110
Posts
28,974,424
Members
1,229,741
Latest member
iamkev
Back
Top