[ create a new paste ] login | about

Recent implementations of FizzBuzz, in:
[ C | C++ | Python ]

C:
pasted on Jan 24:
#include<stdio.h>
int main(void)
{
    int i ;
 
    for(i=1;i<101;i++){
        if(i%3==0 && i%5==0){
            printf("FizzBuzz\n");
        }
        else if(i%3==0){
            printf("Fizz\n");
        }
        else if(i%5==0){
            printf("Buzz\n");
        }
        else{
            printf("%d\n",i);
        }
    }
     
    return 0;
}
view (22 lines, 100 lines of output)
pasted on Dec 8:
#include<stdio.h>
int main(void)
{
    int i ;
 
    for(i=1;i<101;i++){
        if(i%3==0 && i%5==0){
            printf("FizzBuzz\n");
        }
        else if(i%3==0){
            printf("Fizz\n");
        }
        else if(i%5==0){
            printf("Buzz\n");
        }
        else{
            printf("%d\n",i);
        }
    }
     
    return 0;
}
view (22 lines, 100 lines of output)


C++:
pasted on Aug 15:
#include<stdio.h>
int main(void)
{
    int i ;
 
    for(i=1;i<101;i++){
        if(i%3==0 && i%5==0){
            printf("FizzBuzz\n");
        }
        else if(i%3==0){
            printf("Fizz\n");
        }
        else if(i%5==0){
            printf("Buzz\n");
        }
        else{
            printf("%d\n",i);
        }
    }
     
    return 0;
}
view (22 lines, 100 lines of output)
pasted on Aug 10:
#include<stdio.h>
int main(void)
{
    int i ;
 
    for(i=1;i<101;i++){
        if(i%3==0 && i%5==0){
            printf("FizzBuzz\n");
        }
        else if(i%3==0){
            printf("Fizz\n");
        }
        else if(i%5==0){
            printf("Buzz\n");
        }
        else{
            printf("%d\n",i);
        }
    }
     
    return 0;
}
view (22 lines, 100 lines of output)


Python:
pasted on Dec 20:
1
2
3
4
5
6
7
8
9
for i in range(1, 101):
    if i % 3 == 0 and i % 5 == 0:
        print("FizzBuzz")
    elif i % 3 == 0:
        print("Fizz")
    elif i % 5 == 0:
        print("Buzz")
    else:
        print(i)
view (9 lines, 100 lines of output)
pasted on Aug 26:
1
2
3
4
5
6
7
8
for i in range(1, 101):
    if i % 3 == 0 and i % 5 == 0:
        print('FizzBuzz')
    elif i % 3 == 0:
        print('Fizz')
    elif i % 5 == 0:
        print('Buzz')
    else: print(str(i))
view (8 lines, 100 lines of output)