Advertisement
vencinachev

Preprocessor-LOOPS

Mar 16th, 2022
856
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. #define LOOP 1
  4.  
  5. int main(){
  6.     #ifdef LOOP
  7.         #if LOOP == 1
  8.            for (int i = 0; i < 10; i++){
  9.               printf("Hello\n");
  10.            }
  11.         #elif LOOP == 2
  12.            int i = 0;
  13.            while (i < 10){
  14.               printf("Hello\n");
  15.               i++;
  16.            }
  17.         #elif LOOP == 3
  18.            int i = 0;
  19.            do{
  20.              printf("Hello\n");
  21.              i++;
  22.            } while (i < 10);
  23.         #endif
  24.     #else
  25.         printf("LOOP is not defined!\n");
  26.     #endif
  27.    return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement