Advertisement
karlakmkj

Do...While Loop with if

Nov 20th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.48 KB | None | 0 0
  1. using System;
  2.  
  3. namespace JumpStatements
  4. {
  5.   class Program
  6.   {
  7.     static void Main(string[] args)
  8.     {
  9.       bool buttonClick = true;
  10.       int count = 0;
  11.       do
  12.       {
  13.         Console.WriteLine("BLARRRRR");
  14.         count++;           //If the alrarm rings more than 3 times, it should shut off.
  15.         if (count == 3){   //it should break out of the loop if the count variable reaches three.
  16.           break;
  17.         }
  18.       } while(!buttonClick);
  19.     }
  20.   }
  21. }
  22.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement