Skip to content

Commit a8475d7

Browse files
Aayush BisenMadhavBahl
authored andcommitted
Review my submissions (#7)
* fizzbuzz problem Solved in C language. * String Reversal Solved in C language * Factorial using Recursion Solved in C language * README updated C implementations added * fixed link * Add @aayushbisen as a contributor * Author details added
1 parent 7077104 commit a8475d7

File tree

9 files changed

+342
-149
lines changed

9 files changed

+342
-149
lines changed

.all-contributorsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@
2929
"doc",
3030
"code"
3131
]
32+
},
33+
{
34+
"login": "aayushbisen",
35+
"name": "Aayush Bisen",
36+
"avatar_url": "https://avatars2.githubusercontent.com/u/41341387?v=4",
37+
"profile": "https://github.com/aayushbisen",
38+
"contributions": [
39+
"code"
40+
]
3241
}
3342
]
3443
}

CONTRIBUTORS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11

2-
[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors)
2+
[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors)
33
## Contributors
44

55
Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):
66

77
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
88
<!-- prettier-ignore -->
9-
| [<img src="https://avatars2.githubusercontent.com/u/26179770?v=4" width="100px;"/><br /><sub><b>MADHAV BAHL</b></sub>](http://madhavbahl.tech/)<br />[📖](https://github.com/MadhavBahlMD/DailyCodes/commits?author=MadhavBahlMD "Documentation") [💻](https://github.com/MadhavBahlMD/DailyCodes/commits?author=MadhavBahlMD "Code") [🎨](#design-MadhavBahlMD "Design") | [<img src="https://avatars2.githubusercontent.com/u/32531173?v=4" width="100px;"/><br /><sub><b>Rajdeep Roy Chowdhury</b></sub>](http://www.linkedin.com/in/razdeeproychowdhury)<br />[📖](https://github.com/MadhavBahlMD/DailyCodes/commits?author=Razdeep "Documentation") [💻](https://github.com/MadhavBahlMD/DailyCodes/commits?author=Razdeep "Code") |
10-
| :---: | :---: |
9+
| [<img src="https://avatars2.githubusercontent.com/u/26179770?v=4" width="100px;"/><br /><sub><b>MADHAV BAHL</b></sub>](http://madhavbahl.tech/)<br />[📖](https://github.com/MadhavBahlMD/DailyCodes/commits?author=MadhavBahlMD "Documentation") [💻](https://github.com/MadhavBahlMD/DailyCodes/commits?author=MadhavBahlMD "Code") [🎨](#design-MadhavBahlMD "Design") | [<img src="https://avatars2.githubusercontent.com/u/32531173?v=4" width="100px;"/><br /><sub><b>Rajdeep Roy Chowdhury</b></sub>](http://www.linkedin.com/in/razdeeproychowdhury)<br />[📖](https://github.com/MadhavBahlMD/DailyCodes/commits?author=Razdeep "Documentation") [💻](https://github.com/MadhavBahlMD/DailyCodes/commits?author=Razdeep "Code") | [<img src="https://avatars2.githubusercontent.com/u/41341387?v=4" width="100px;"/><br /><sub><b>Aayush Bisen</b></sub>](https://github.com/aayushbisen)<br />[💻](https://github.com/MadhavBahlMD/DailyCodes/commits?author=aayushbisen "Code") |
10+
| :---: | :---: | :---: |
1111
<!-- ALL-CONTRIBUTORS-LIST:END -->
1212

1313
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!

code1/README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Read Full Problem Here: [Fizz Buzz](https://medium.com/code-to-express/daily-cod
66

77
![cover](./cover.png)
88

9-
## [JavaScript implementation](./strRev.js)
9+
## [JavaScript implementation](./fizzbuzz.js)
1010

1111
```js
1212
function fizzbuzz (num) {
@@ -30,4 +30,27 @@ console.log('FizzBuzz upto 5');
3030
fizzbuzz(5);
3131
```
3232

33-
![fizzbuzz](./code.png)
33+
![fizzbuzz](./code.png)
34+
35+
## [C implementation](./fizzbuzz.c)
36+
37+
```c
38+
#include<stdio.h>
39+
40+
int main(void) {
41+
int i;
42+
43+
for(i=1 ; i<101 ; i++) {
44+
if(i%15 == 0)
45+
printf("\nFizzBuzz ");
46+
else if(i%5 == 0)
47+
printf("\nBuzz ");
48+
else if(i%3 == 0)
49+
printf("\nFizz ");
50+
else
51+
printf("\n%d ", i);
52+
}
53+
54+
return 0;
55+
}
56+
```

code1/fizzbuzz.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
*Author: Aayush Bisen
3+
*GitHub: https://github.com/aayushbisen
4+
*/
5+
6+
#include<stdio.h>
7+
8+
int main(void)
9+
{
10+
int i;
11+
12+
for(i=1 ; i<101 ; i++)
13+
{
14+
if(i%15 == 0)
15+
{
16+
printf("\nFizzBuzz ");
17+
}
18+
else if(i%5 == 0)
19+
{
20+
printf("\nBuzz ");
21+
}
22+
else if(i%3 == 0)
23+
{
24+
printf("\nFizz ");
25+
}
26+
else
27+
{
28+
printf("\n%d ", i);
29+
}
30+
}
31+
32+
return 0;
33+
}

code2/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,39 @@ stringRevList=[strRev(i) for i in stringList]
3131
# Guess the output!
3232
for i in stringRevList:
3333
print(i)
34+
```
35+
36+
## [C Implementation](./strRev.c)
37+
38+
```c
39+
// strRev Function
40+
void strRev( char str[MAX] ) {
41+
int i;
42+
int j;
43+
char temp;
44+
45+
for(i=0 ; str[i]!='\0' ; i++);
46+
47+
j=0;
48+
i = i-1;
49+
50+
while(j<i) {
51+
temp = str[j];
52+
str[j] = str[i];
53+
str[i] = temp;
54+
j++;
55+
i--;
56+
}
57+
printf("The reversed string is %s", str);
58+
}
59+
60+
// main Function
61+
int main(void) {
62+
char string[MAX];
63+
64+
printf("Enter the string: ");
65+
gets(string);
66+
strRev(string);
67+
return 0;
68+
}
3469
```

code2/strRev.c

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
*Author: Aayush Bisen
3+
*GitHub: https://github.com/aayushbisen
4+
*/
5+
6+
7+
#include<stdio.h>
8+
#define MAX 100
9+
10+
void strRev( char str[MAX] );
11+
12+
int main(void)
13+
{
14+
char string[MAX];
15+
16+
printf("Enter the string: ");
17+
gets(string);
18+
strRev(string);
19+
return 0;
20+
}
21+
22+
23+
void strRev( char str[MAX] )
24+
{
25+
int i;
26+
int j;
27+
char temp;
28+
29+
for(i=0 ; str[i]!='\0' ; i++);
30+
31+
j=0;
32+
i = i-1;
33+
34+
while(j<i)
35+
{
36+
temp = str[j];
37+
str[j] = str[i];
38+
str[i] = temp;
39+
j++;
40+
i--;
41+
}
42+
43+
printf("The reversed string is %s", str);
44+
}

code3/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,24 @@ def fact(n):
3232
# Guess the output!
3333
print(fact(3))
3434
print(fact(4))
35+
```
36+
37+
## [C Implementation](./fact.c)
38+
39+
```c
40+
// fact Function
41+
int fact(int num) {
42+
if(num == 0)
43+
return 1;
44+
else
45+
return num * fact(num - 1);
46+
}
47+
48+
//main Function
49+
int main(void) {
50+
int answer;
51+
answer = fact(5);
52+
printf("Factorial is: %d", answer);
53+
return 0;
54+
}
3555
```

code3/fact.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
*Author: Aayush Bisen
3+
*GitHub: https://github.com/aayushbisen
4+
*/
5+
6+
7+
#include<stdio.h>
8+
9+
int fact(int num);
10+
11+
int main(void)
12+
{
13+
int answer;
14+
answer = fact(5);
15+
printf("Factorial is: %d", answer);
16+
return 0;
17+
}
18+
19+
int fact(int num)
20+
{
21+
if(num == 0)
22+
{
23+
return 1;
24+
}
25+
else
26+
{
27+
return num * fact(num - 1);
28+
}
29+
}

0 commit comments

Comments
 (0)