Created
September 5, 2023 11:01
-
-
Save HSley13/aec433fada84171f3d52182341f28da6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstdlib> | |
#include <cmath> | |
using namespace std; | |
int main() | |
{ | |
int table[10]; int a, b, i, size=10; | |
for(i=0; i<size; i++) table[i]= rand(); | |
cout<<" This is the orinal Array \n"; | |
for(i=0; i<size; i++) | |
{ | |
cout<<table[i]<<endl; | |
} | |
cout<<endl; | |
for(a=0; a<size; a++) | |
{ | |
for(b=size-1; b>=a; b--) | |
{ | |
if (table[b-1]>table[b]) | |
{ | |
i=table[b-1]; | |
table[b-1]=table[b]; | |
table[b]=i; | |
} | |
} | |
} | |
cout<<" The New Array is presented thus "<<endl; | |
for(i=0; i<size; i++) | |
{ | |
cout<<table[i]<<endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment