Advertisement
clairec

fizzbuzz.c

Jan 25th, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4.     int i;
  5.     for (i = 1; i <= 100; i++) {
  6.         if (i % 3 != 0 && i % 5 != 0) {
  7.             printf("%d\n", i);
  8.             continue;
  9.         }
  10.         if (i % 3 == 0) {
  11.             printf("Fizz");
  12.         }
  13.         if (i % 5 == 0) {
  14.             printf("Buzz");
  15.         }
  16.         printf("\n");
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement