Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.97 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace FizzBuzz
  7. {
  8.     class Program
  9.     {
  10.         /* I realized that I misspelled "buzz" as "bizz."*/
  11.         static void Main(string[] args)
  12.         {
  13.             for (int x = 1; x <= 100; x++)
  14.             {
  15.  
  16.                 if (x % 3 == 0 && x % 5 == 0)
  17.                 {
  18.                     Console.WriteLine("FizzBuzz");
  19.                 }
  20.                 else
  21.                 {
  22.                     if (x%3 == 0)
  23.                     {
  24.                         Console.WriteLine("Fizz");
  25.                     }
  26.  
  27.                     if (x%5 == 0)
  28.                     {
  29.                         Console.WriteLine("Buzz");
  30.                     }
  31.                     if (x%3 != 0 && x%5 != 0)
  32.                     {
  33.                         Console.WriteLine(x);
  34.                     }
  35.  
  36.  
  37.                 }
  38.             }
  39.  
  40.             Console.ReadKey();
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement