Posted By

rwczippy on 04/09/11


Tagged

c# razor fizzbuzz


Versions (?)

fizzbuzz in Razor


 / Published in: C#
 

my take on fizzbuzz written in C#.Net - Razor

  1. <div>
  2. @{
  3.  
  4. var end = 100;
  5. for (int i = 1; i < end; i++)
  6. {
  7. <span>@i</span>
  8. if (i % 5 == 0 && i % 3 == 0)
  9. {
  10. <span>fizzbuzz</span>
  11. }
  12. else if (i % 3 == 0)
  13. {
  14. <span>fizz</span>
  15. }
  16. else if (i % 5 == 0)
  17. {
  18. <span>buzz</span>
  19. }
  20. else
  21. {
  22. <span>@i</span>
  23. }
  24. <br />
  25. }
  26. }
  27. </div>

Report this snippet  

You need to login to post a comment.