Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
86331d6
Merge pull request #29 from swaaz/master
swaaz Oct 2, 2019
b43ba9a
Merge pull request #31 from classsankalp/master
swaaz Oct 8, 2019
78bdd2c
Update contribution.md
swaaz Oct 9, 2019
f6ccad8
Update contribution.md
swaaz Oct 9, 2019
70b983b
Merge pull request #32 from swaaz/swaaz
swaaz Oct 9, 2019
ea1991a
Merge pull request #33 from swaaz/master
swaaz Oct 9, 2019
f7678bb
Merge pull request #1 from swaaz/master
ruthud Oct 9, 2019
0d88c1d
program added
Oct 9, 2019
b4743f8
Merge pull request #34 from ruthud/ruthu
swaaz Oct 9, 2019
32baef4
Merge pull request #35 from swaaz/master
swaaz Oct 9, 2019
2b49370
Update program.c
swaaz Oct 9, 2019
904b8de
Merge pull request #36 from swaaz/swaaz
swaaz Oct 9, 2019
e091fa1
Merge pull request #37 from swaaz/master
swaaz Oct 9, 2019
631dcd1
Update README.md
swaaz Oct 9, 2019
4369fa3
Merge pull request #38 from swaaz/swaaz
swaaz Oct 9, 2019
8898918
Merge pull request #39 from swaaz/master
swaaz Oct 9, 2019
f48f89e
added program
RachithaRai Oct 12, 2019
067ead3
Merge pull request #40 from RachithaRai/tatti
swaaz Oct 12, 2019
9af8de7
Update README.md
RachithaRai Oct 12, 2019
1fa2bb2
Merge pull request #41 from RachithaRai/tatti
swaaz Oct 12, 2019
9388dda
Create program42.c
sharansk792000 Oct 12, 2019
8a23502
Merge pull request #43 from sharansk792000/patch-2
swaaz Oct 12, 2019
b7bb977
Create program.c
sharansk792000 Oct 12, 2019
a1aee53
Merge pull request #45 from sharansk792000/patch-4
swaaz Oct 12, 2019
ab3be0c
Create program.c
sharansk792000 Oct 12, 2019
999435a
Merge pull request #46 from sharansk792000/patch-5
swaaz Oct 12, 2019
643a9e9
Create program.c
sharansk792000 Oct 12, 2019
105c161
Merge pull request #48 from sharansk792000/patch-7
swaaz Oct 12, 2019
15049b6
Merge pull request #49 from swaaz/master
swaaz Oct 21, 2019
8a61d62
Merge pull request #50 from swaaz/swaaz
swaaz Oct 21, 2019
82d01e6
updated
swaaz Oct 21, 2019
ff2c19e
Merge pull request #51 from swaaz/swaaz
swaaz Oct 21, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/ISSUE_TEMPLATE/contribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
- Fork this [repo](https://github.com/swaaz/basicprograms)
- Clone it using command :
<pre> $ git clone paste_the_copied_url.</pre>
- Open folder "basicprograms" :
<pre>$ cd basicprograms</pre>
- Open folder "C/Python" :
<pre>$ cd filder_name</pre>
<pre>$ cd folder_name</pre>
eg:cd C
- Create new branch :
<pre> $ git branch new_branch_name</pre>
Expand Down
45 changes: 45 additions & 0 deletions C/Program-43/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

// C program for printing the hollow triangle pattern

#include <stdio.h>

// Function for printing pattern
void pattern(int N)
{
int i, j, k = 0, space = 1, rows = N;

// For printing stars
for (i = rows; i >= 1; i--) {
for (j = 1; j <= i; j++) {
printf("*");
}
if (i != rows) {
// for printing space
for (k = 1; k <= space; k++) {
printf(" ");
}

// increment by 2
space = space + 2;
}
for (j = i; j >= 1; j--) {
if (j != rows)
printf("*");
}
printf("\n");
}
printf("\n");
}

// Driver code
int main()
{

// Get N
int N = 6;

// Print the pattern
pattern(N);

return 0;
}
7 changes: 7 additions & 0 deletions C/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,11 @@
| Program-37 | Program to find the fibonacci sequnce using recursion |
| Program-38 | Program to find the factorial of a number using recursion |
| Program-39 | Program to find the GCD of a number using recursion |
| Program-40 | Program to find the ackerman of given two numbers|
| Program-41 | Program to find sum of two numbers without using any operator |
| Program-42 | Program to print Floyd’s triangle Without using a temporary variable and with only one loop |
| Program-43 | Program for printing the hollow triangle pattern |
| Program-44 | Program for implementation of the approach |
| Program-45 | Program to illustrate the above given pattern of numbers. |


22 changes: 22 additions & 0 deletions C/program-40/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*Write a C program to find the Ackermann of 2 Numbers*/

#include<stdio.h>
int ack(int m,int n)
{
if(m==0)
return n+1;
else if(m!=0 && n==0)
return ack(m-1,1);
else if (m!=0 && n!=0)
return ack(m-1,ack(m,n-1));
}

int main()
{
int a,b,c;
printf("Enter 2 Elements:\n");
scanf("%d%d",&a,&b);
c=ack(a,b);
printf("Ackermann(%d,%d)=%d",a,b,c);
return 0;
}
14 changes: 14 additions & 0 deletions C/program-41/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*To find sum of two numbers without using any operator*/
#include<stdio.h>

int add(int x, int y)
{
return printf("%*c%*c", x, ' ', y, ' ');
}

// Driver code
int main()
{
printf("Sum = %d", add(3, 4));
return 0;
}
17 changes: 17 additions & 0 deletions C/program-42/program42.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*C Program to print Floyd’s triangle*/
// Without using a temporary variable and with only one loop
#include<stdio.h>
void floyd(n){
int i,j=1;
for (i=1;i<=(n*(n+1))/2;i++){
printf("%d ",i);
if(i==(j*(j+1))/2){
printf("\n");
j++;
}
}
}

int main(){
floyd(6);
}
48 changes: 48 additions & 0 deletions C/program-44/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// C implementation of the approach
#include <stdio.h>

// Function to print the desired
// Alphabet Z Pattern
void alphabet_Z_Pattern(int N)
{
int index, side_index, size;

// Declaring the values of Right,
// Left and Diagonal values
int Top = 1, Bottom = 1, Diagonal = N - 1;

// Loop for printing the first row
for (index = 0; index < N; index++)
printf("%d ", Top++);

printf("\n");

// Main Loop for the rows from (2 to n-1)
for (index = 1; index < N - 1; index++) {

// Spaces for the diagonals
for (side_index = 0; side_index < 2 * (N - index - 1);
side_index++)
printf(" ");

// Printing the diagonal values
printf("%d", Diagonal--);

printf("\n");
}

// Loop for printing the last row
for (index = 0; index < N; index++)
printf("%d ", Bottom++);
}

// Driver Code
int main()
{
// Size of the Pattern
int N = 5;

alphabet_Z_Pattern(N);

return 0;
}
37 changes: 37 additions & 0 deletions C/program-45/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

// C program to illustrate the above given pattern of numbers.
#include<stdio.h>

int main()
{
int n = 5, i, j, num = 1, gap;

gap = n - 1;

for ( j = 1 ; j <= n ; j++ )
{
num = j;

for ( i = 1 ; i <= gap ; i++ )
printf(" ");

gap --;

for ( i = 1 ; i <= j ; i++ )
{
printf("%d", num);
num++;
}
num--;
num--;
for ( i = 1 ; i < j ; i++)
{
printf("%d", num);
num--;
}
printf("\n");

}

return 0;
}