need simple code sample

Posted by PAVA under C# on 7/26/2012 | Points: 10 | Views : 1277 | Status : [Member] | Replies : 1
A brief code sample (in any standard language, C#, VB.Net, Java, Javascript, etc):
Create a recursive function that takes an integer as an input and writes out the console the value that follows this pattern, until 0 is reached, then exit. The pattern is simple:
For input value of 7 => -6, 5, -4, 3, -2, 1, 0
For input value of 3 => -2, 1, 0
For input value of -9 => 8, -7, 6, -5, 4, -3, 2, -1, 0




Responses

Posted by: lakhansin-22735 on: 7/9/2013 [Member] Starter | Points: 25

Up
0
Down
Hi,

Can you please give some business logic for following, so that I can frame it into C# code

For input value of 7 => -6, 5, -4, 3, -2, 1, 0
For input value of 3 => -2, 1, 0
For input value of -9 => 8, -7, 6, -5, 4, -3, 2, -1, 0

Thanks,

Lakhan Singh
Tech Lead
BeyondKey System Pvt. Ltd.
Indore, M.P.
India

PAVA, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response