From 67cdb95b64a91fd95ccf3729eec62d93a0165085 Mon Sep 17 00:00:00 2001 From: Sarveswara Rao Kanduri Date: Thu, 1 Oct 2020 11:02:42 +0530 Subject: [PATCH 1/3] anonymousksr added Fizzbuzz --- Day1/C/fizzbuzzy.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Day1/C/fizzbuzzy.c diff --git a/Day1/C/fizzbuzzy.c b/Day1/C/fizzbuzzy.c new file mode 100644 index 00000000..202e1f5b --- /dev/null +++ b/Day1/C/fizzbuzzy.c @@ -0,0 +1,24 @@ +/* + * @author: anonymousksr + * @date: 01/10/2020 +*/ +#include + +int main(void) +{ + int i; + for(i=1; i<=100; i++) + { + if(((i%3)||(i%5))== 0) + printf("number= %d FizzBuzz\n", i); + else if((i%3)==0) + printf("number= %d Fizz\n", i); + else if((i%5)==0) + printf("number= %d Buzz\n", i); + else + printf("number= %d\n",i); + + } + + return 0; +} \ No newline at end of file From dab66ac21e2e8c2a79f0f93e9e271a48c6ccb771 Mon Sep 17 00:00:00 2001 From: Sarveswara Rao Kanduri <47494248+anonymousksr@users.noreply.github.com> Date: Thu, 1 Oct 2020 11:13:36 +0530 Subject: [PATCH 2/3] Update README.md --- Day1/README.md | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/Day1/README.md b/Day1/README.md index bf8b6608..eea89c09 100644 --- a/Day1/README.md +++ b/Day1/README.md @@ -149,6 +149,45 @@ int main() return 0; } ``` +### [fizzbuzzy.c](./C/fizzbuzzy.c) + +```c +/** + * @author: Sarveswara Rao Kanduri + * @github: https://github.com/anonymousksr + * @date: 01/10/2020 +**/ + +#include + +int main() +{ + int n; + printf("Enter a number upto which you want to find Fizzbuzz numbers "); + scanf("%d", &n); + for (int i = 1; i <= n; i++) + { + if (i % 5 == 0 && i % 3 == 0) + { + printf("FizzBuzz\n"); + } + else if (i % 5 == 0) + { + printf("Buzz\n"); + } + else if (i % 3 == 0) + { + printf("Fizz\n"); + } + else + { + printf("%d\n", i); + } + } + return 0; +} +``` + ## Python(3) Implementation @@ -256,6 +295,8 @@ int main() } ``` + + ### [C# Solution](./C#/FizzBuzz.cs) ```cs @@ -410,4 +451,4 @@ for ($i=1; $i <= $num; $i++) { The beauty of programming lies in the fact that there is never a single solution to any problem. -In case you have an alternative way to solve this problem, do contribute to this repository (https://github.com/CodeToExpress/dailycodebase) :) \ No newline at end of file +In case you have an alternative way to solve this problem, do contribute to this repository (https://github.com/CodeToExpress/dailycodebase) :) From 53137bde5b0f470fa5bea8ed444c8a7e10aba157 Mon Sep 17 00:00:00 2001 From: Sarveswara Rao Kanduri <47494248+anonymousksr@users.noreply.github.com> Date: Thu, 1 Oct 2020 11:15:21 +0530 Subject: [PATCH 3/3] Update README.md --- Day1/README.md | 68 ++++++++------------------------------------------ 1 file changed, 11 insertions(+), 57 deletions(-) diff --git a/Day1/README.md b/Day1/README.md index eea89c09..fefcb1d3 100644 --- a/Day1/README.md +++ b/Day1/README.md @@ -122,68 +122,22 @@ public class Fizzbuzz { #include -int main() +int main(void) { - int n; - printf("Enter a number upto which you want to find Fizzbuzz numbers "); - scanf("%d", &n); - for (int i = 1; i <= n; i++) + int i; + for(i=1; i<=100; i++) { - if (i % 5 == 0 && i % 3 == 0) - { - printf("FizzBuzz\n"); - } - else if (i % 5 == 0) - { - printf("Buzz\n"); - } - else if (i % 3 == 0) - { - printf("Fizz\n"); - } + if(((i%3)||(i%5))== 0) + printf("number= %d FizzBuzz\n", i); + else if((i%3)==0) + printf("number= %d Fizz\n", i); + else if((i%5)==0) + printf("number= %d Buzz\n", i); else - { - printf("%d\n", i); - } - } - return 0; -} -``` -### [fizzbuzzy.c](./C/fizzbuzzy.c) - -```c -/** - * @author: Sarveswara Rao Kanduri - * @github: https://github.com/anonymousksr - * @date: 01/10/2020 -**/ - -#include + printf("number= %d\n",i); -int main() -{ - int n; - printf("Enter a number upto which you want to find Fizzbuzz numbers "); - scanf("%d", &n); - for (int i = 1; i <= n; i++) - { - if (i % 5 == 0 && i % 3 == 0) - { - printf("FizzBuzz\n"); - } - else if (i % 5 == 0) - { - printf("Buzz\n"); - } - else if (i % 3 == 0) - { - printf("Fizz\n"); - } - else - { - printf("%d\n", i); - } } + return 0; } ```