Please give easy solution i am not able to solve!

Please give an easy solution I am not able to solve!!

hi @akshat1409 refer this https://ide.codingblocks.com/s/627388

we have not been taught vectors yet please gie a solution without using vectors

https://ide.codingblocks.com/s/667152 please tell whats the fault with this code? logically its orking

?? https://ide.codingblocks.com/s/667152 please tell whats the fault with this code? logically its orking

hi @akshat1409 sorry i missed it can u please comment the code and tell the logic there

https://ide.codingblocks.com/s/667152 commented the logic

hi @akshat1409 this is not the case u need to perform all the operations and then add all the elements of array and print it u do all shifting first and add to array then finally add all elements refer the code i shared, im commenting this out and read the question again do a dryrun of the code for the eg test case https://ide.codingblocks.com/s/667197

we have not been taught vectors yet. can u tell the use of vectors in this code and how is it different from any random array we make?

It’s same u can replace it with array of size n