My issue
i am getting the output in this question but elements are not coming with correct spacing pls tell my error
My code
#include <stdio.h>
int main() {
int arr[100] = {4, 5, 3, 10, 12, 18}; // Initial array
int size=5; // Current size of the array
int newPosition = 5; // Index where you want to insert the new element
int newElement = 7; // Element to be inserted
for (int i=size -1 ;i>=newPosition;i--) {
arr[i+1]=arr[i];
}
arr[newPosition]=newElement;
size++;
for (int i = 0;i < size; i++) {
printf("%d",arr[i]);
}
return 0;
}
Learning course: Data structures & Algorithms lab
Problem Link: https://www.codechef.com/learn/course/muj-aiml-dsa-c/MUJADSAC05/problems/DSAAGP07A