One approach could be using the file.
Say x = 50 %, so every alternate run, the output should be true.

1. First run, store 0.5 in the file
2. Second run, add 0.5 to the previous value
3. Check if the sum is 1.d where 0 <= d < 1, return true and store 0.d in
the file

We can extend the same logic for any value of x.

--
Pankaj

On Wed, Nov 30, 2011 at 12:45 PM, atul anand <atul.87fri...@gmail.com>wrote:

> @nitin : as mentioned in the subject , its for Apple
>
> BTW @siddharth , i did not understand your question . little more
> explanation please.
>
> On Mon, Nov 28, 2011 at 7:14 PM, Nitin Garg <nitin.garg.i...@gmail.com>wrote:
>
>> Please clarify. Also tell offcampus interview for which company?
>>
>>
>> On Mon, Nov 28, 2011 at 7:10 PM, Siddharth Pipriya <sid....@gmail.com>wrote:
>>
>>> write a program that takes as input a number x and gives output true x
>>> percent of the time it is run.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>>
>>
>> --
>> Nitin Garg
>>
>> "Personality can open doors, but only Character can keep them open"
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to