Hi Friends you know something about the star(*) print in console application. I have given many interview on .net application. Every time asking print the star(*) and how many loop are needed and so on. So I think this is very use full every one. So, I solve the problem and share with C# Corner website users.

This loop design in Console Application. If you think have any problem in this loops plz share with me and i know my English not good.

  1. static void Main(string[] args)
  2. {
  3. Console.WriteLine("Enter Your Name ");
  4. string temp=Console.ReadLine();
  5. Console.WriteLine("");
  6. Console.WriteLine("");
  7. Console.WriteLine("");
  8. string temp2 = temp;
  9. string temp3 = "";
  10. temp += " ";
  11. temp2 += " ";
  12. for (int i = temp.Length-1; i >0 ; i--)
  13. {
  14. temp3 += " ";
  15. Console.WriteLine("{0}"+temp3 +"{1}", temp.Remove(i), (temp2.Remove(i)));
  16. }
  17. temp3 += " ";
  18. for (int i = 1; i < temp.Length; i++)
  19. {
  20. Console.WriteLine("{0}"+temp3.Remove(temp3.Length-i-i-i+1)+"{1}", temp.Remove(i), (temp2.Remove(i)));
  21. }
  22. Console.WriteLine("");
  23. Console.WriteLine("");
  24. Console.WriteLine("");
  25. }
Output

output

Happy Coding