SHARE
TWEET

Untitled

a guest Jun 19th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * Simple FizzBuzz in C by rogafe
  3.  * This file is subject to the terms and conditions defined in
  4.  * file 'LICENSE.txt', which is part of this source code package.
  5.  */
  6. #include "main.h"
  7.  
  8. int fizzbuzz(int a) {
  9.   int i;
  10.     for (i=0; i<a; i++)
  11.       {
  12.         if (i % 15 == 0){
  13.           printf("FizzBuzz\n");
  14.             }
  15.         else if (i % 3 == 0) {
  16.           printf("Fizz\n");
  17.         }
  18.         else if (i % 5 == 0 ){
  19.           printf("Buzz\n");
  20.         }
  21.         else {
  22.           printf("%d\n", i);
  23.         }
  24.       }
  25.     printf("i = %d & a = %d\n", i, a);
  26.  
  27. }
  28.  
  29. int main(int argc, char* argv[]) {
  30.   printf("This is my example of fizzbuzz\nWill it work ?\nPress any key to continue\n");
  31.   getchar();
  32.  
  33.   fizzbuzz(1000);
  34.   printf("Hello world \n");
  35.  
  36.  
  37.  
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top