Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Pure VPN - Up to 27 Months
vgp
Updated:
Today at 8:10 AM
එක පැකේජ් එකයි මාසෙටම Unlimited Internet. තාමත් DATA CARD දාන්න සල්ලි වියදම් කරනවද? අඩුම මිලට අපෙන්.
sayuru bandara
Updated:
Tuesday at 12:30 PM
Ad icon
ඉන්ටර්නෙට් එකෙන් හරියටම සල්ලි හොයන්න සහ Success වෙන්න කැමතිද? 🚀 (E-Money & Success Stories)
siri sumana
Updated:
Saturday at 11:44 PM
Gemini AI PRO 18 months Offer
Hawaka
Updated:
May 27, 2026
Ad icon
koko account
DasunEranga
Updated:
May 27, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Help
Write a C++ Program...
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="viraj_slk" data-source="post: 7369060" data-attributes="member: 51932"><p>integer input 3 will shift each number by 3 places (not two). so the output should be like on your original question.</p><p></p><p>3,4,5,1,2</p><p></p><p>[PHP]</p><p>arr[1,2,3,4,5] // current array </p><p>new_arr[] // new array we are going to build</p><p>int p; // the new position for each element in array</p><p></p><p>for(i= 0; i < n; i++){</p><p> p = (i + x)%n; // remember n is the number of values in array & x is user input value</p><p> </p><p> new_arr[p] = arr[i]; </p><p>} </p><p>[/PHP]</p><p></p><p>The above is the code solution to your problem. The only thing you have to do is put the right syntax's. I will post the code later but you would have done nothing on your part other than copy and paste. </p><p></p><p>Write down your problem on paper and think of this solution, try to figure it out. I will write the code later tonite. dont have time now.</p></blockquote><p></p>
[QUOTE="viraj_slk, post: 7369060, member: 51932"] integer input 3 will shift each number by 3 places (not two). so the output should be like on your original question. 3,4,5,1,2 [PHP] arr[1,2,3,4,5] // current array new_arr[] // new array we are going to build int p; // the new position for each element in array for(i= 0; i < n; i++){ p = (i + x)%n; // remember n is the number of values in array & x is user input value new_arr[p] = arr[i]; } [/PHP] The above is the code solution to your problem. The only thing you have to do is put the right syntax's. I will post the code later but you would have done nothing on your part other than copy and paste. Write down your problem on paper and think of this solution, try to figure it out. I will write the code later tonite. dont have time now. [/QUOTE]
Insert quotes…
Verification
Payakata winadi keeyak tibeda?
Post reply
Top
Bottom