Created
September 21, 2022 04:37
-
-
Save sandeepnmenon/bb35fed22a0697f14ac599464454e060 to your computer and use it in GitHub Desktop.
Duff's device
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
int count = 7; | |
switch ( | |
count % 5) | |
{ | |
case 0: | |
while (--count > 0) // for (; --count > 0;) | |
{ | |
cout << count % 5 << endl; | |
case 1: | |
cout << count % 5 << endl; | |
case 2: | |
cout << count % 5 << endl; | |
case 3: | |
cout << count % 5 << endl; | |
case 4: | |
cout << count % 5 << endl; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment