i know 3 solns!
1) int n = 20;
int i;
for (i=0; i+n; i--)
printf("MS");
2) int n = 20;
int i;
for (i=0; i<n; n--)
printf("MS");
3) int n = 20;
int i;
for (i=0; -i<n; i--)
printf("MS");
On Tue, Jul 19, 2011 at 10:27 PM, Reynald <[email protected]> wrote:
> Given the following program, "MS" will be printed, infinite number of
> times:
> int n = 20;
> int i;
> for (i=0; i<n; i--)
> printf("MS");
>
> Apply one of the following three operations one at a time such that
> "MS" can be printed 20 times.
> 1. You can add only one character into it.
> 2. you can delete only one character in it.
> 3. You can replace a character by another character.
>
> Find all possible solutions for this problem.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>
--
.... radhika .. :)
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.