Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
582 B
5
Indexable
Never
// Online C compiler to run C program online
#include <stdio.h>

int main() {
    // Write C code here
    int size = 10;
    int arr[size];
    
    arr[0] = 1;
    arr[1] = 2;
    arr[2] = 3;
    arr[3] = 5;
    arr[4] = 6;
    
    for(int i = 0;i<size;i++){
        printf("%d ", arr[i]);
    }
    
    // arr[3] = 4;
    
    int index = 3;
    int number = 4;
    
    for(int i = size-2;i>=index;i--){
        arr[i+1]=arr[i];
    }
    arr[index] = 4;
    
    
    
    printf("\n");
    for(int i = 0;i<size;i++){
        printf("%d ", arr[i]);
    }
    
    return 0;
}
Leave a Comment