Weezle

Untitled

Feb 11th, 2019
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. public class Program
  5. {
  6. static string F(string X)
  7. {
  8. if (X.Length > 1)
  9. {
  10. string T = X.Substring(1);
  11. switch (X.Substring(0,1))
  12. {
  13. case "0":
  14. return T;
  15. case "1":
  16. return F(T) + '0' + F(T);
  17. default:
  18. return F(X);
  19. }
  20.  
  21.  
  22. }
  23. else
  24. {
  25. return (F(X));
  26. }
  27. }
  28. public static void Main(string[] args)
  29. {
  30. while (true)
  31. {
  32. Console.Write("X=");
  33. Console.WriteLine("F(x)=" + F(Console.ReadLine()));
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment