Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main(){
- int hold;
- int array[3];
- cout<<"Enter 3 numbers: "<<endl;
- for(int i=0; i<3; i++)
- {
- cin>>array[i];
- }
- for(int j=0; j<3; j++)
- {
- }
- for(int i=0; i<4; i++)
- {
- for(int j=0; j<4; j++)
- {
- if(array[j]>array[j+1])
- {
- hold=array[j];
- array[j]=array[j+1];
- array[j+1]=hold;
- }
- }
- }
- cout<<"Ascending Array is: "<<endl;
- for(int i=0; i<3; i++)
- {
- cout<<array[i]<<endl;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment