Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main (){
- int n;
- cin>>n;
- double a[1005];
- for(int i=0;i<n;i++){
- cin>>a[i];
- }
- double k;
- cin>>k;
- int vt;
- for(int i=0;i<n;i++){
- if (a[i]>k){
- vt=i;
- break;
- }
- }
- for(int i=n;i>=vt;i--){
- a[i]=a[i-1];
- }
- n++;
- a[vt]=k;
- for(int i=0;i<n;i++){
- cout<<fixed<<setprecision (2)<<a[i]<<" ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment