Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
d030994
Create retangleofstar.cpp
akashkumar0987d May 4, 2021
6164248
Create Lofstar.cpp
akashkumar0987d May 4, 2021
76936da
Create sgpaandcgpa.cpp
akashkumar0987d May 4, 2021
52b1eeb
Create sumof2ismorethan1.c
akashkumar0987d May 4, 2021
c54cd6b
Create remainder1.c
akashkumar0987d May 4, 2021
10d7332
Create strictlyincreaseornot.c
akashkumar0987d May 4, 2021
7078ca2
Create LowerUpperBothNonetriangularmatrix.c
akashkumar0987d May 4, 2021
9a4f9c2
Create atleast3distinct.c
akashkumar0987d May 4, 2021
432310a
Create 2ndlargest.c
akashkumar0987d May 4, 2021
bc73624
Create kthoccofn.c
akashkumar0987d May 4, 2021
9e72705
Create movingaverage.c
akashkumar0987d May 4, 2021
dfd936a
Create allfactlessthann.c
akashkumar0987d May 4, 2021
9560cc4
Create largestintnotoccorin2ndarray.c
akashkumar0987d May 4, 2021
4b79da2
Create distinctnoinsequence.c
akashkumar0987d May 4, 2021
7609d1a
Create replaceofChar.c
akashkumar0987d May 4, 2021
e02cf7a
Create CollatzFunction.c
akashkumar0987d May 4, 2021
9a3cb0a
Create fib_problem.c
akashkumar0987d May 4, 2021
646911e
Create reversestringbyrecursion.c
akashkumar0987d May 4, 2021
254dd6f
Create noOfmatchingPositioninAnagram.c
akashkumar0987d May 4, 2021
07d7abd
Create Nodeproblem.c
akashkumar0987d May 4, 2021
7aed6dd
Create longestoccinstring.c
akashkumar0987d May 4, 2021
3bc5a75
Create SortofDatabase.c
akashkumar0987d May 4, 2021
14f544c
Create DeleteallaftercertainelementinLinkedList.c
akashkumar0987d May 4, 2021
c07ba58
Create DoublyLinkedlistproblem.c
akashkumar0987d May 4, 2021
53b9bfb
Create MODuloproblem.c
akashkumar0987d May 4, 2021
d1951dc
Create NoofInversion.c
akashkumar0987d May 4, 2021
eba0dac
Create EncriptedformofStringProblem.c
akashkumar0987d May 4, 2021
9bb6148
Create SumofSeries.c
akashkumar0987d May 4, 2021
b9fb11f
Create Trianglebystar.c
akashkumar0987d May 4, 2021
3b60eaf
Create SumofdiagonalelementofMatrix.c
akashkumar0987d May 4, 2021
a0fe5db
Create Noof1inBinaryofanInt.cpp
akashkumar0987d May 4, 2021
afe122a
Create TransposeofMatrix.c
akashkumar0987d May 4, 2021
74a2cd1
Create productofMatrix.c
akashkumar0987d May 4, 2021
121ded5
Create MultiplicationofMatrixbyRecursion.c
akashkumar0987d May 4, 2021
a0b4d0d
Create sumanddifferenceofMatrix.c
akashkumar0987d May 4, 2021
0b1d6a4
Create MatrixEqualornot.c
akashkumar0987d May 4, 2021
2d91837
Create IdentityMatrixornot.c
akashkumar0987d May 4, 2021
fdb0bae
Create SparseMatrixornot.c
akashkumar0987d May 4, 2021
953d7fc
Create InterchangeRowandColumn.c
akashkumar0987d May 4, 2021
2fd2db3
Create NoOfOddEveninMatrix.c
akashkumar0987d May 4, 2021
b879e69
Create InterchangeofDiagonal.c
akashkumar0987d May 4, 2021
578b0b8
Create LCMbyRecursion.c
akashkumar0987d May 4, 2021
85fe727
Create GCDbyRecursion.c
akashkumar0987d May 4, 2021
1f5525a
Create productbyRecursion.c
akashkumar0987d May 4, 2021
ca59f5e
Create Powerbyrecursion.c
akashkumar0987d May 4, 2021
c05ed59
Create BinarybyRecursion.c
akashkumar0987d May 4, 2021
7f24a89
Create firstCap.c
akashkumar0987d May 4, 2021
fd7088e
Create BintoHexa.c
akashkumar0987d May 4, 2021
b9b64b9
Create BinarytoOctal.c
akashkumar0987d May 4, 2021
7850da5
Create DectoOctal.c
akashkumar0987d May 4, 2021
c2fc4a3
Create DecimaltoHexa.c
akashkumar0987d May 4, 2021
3a4bf2b
Create RomanTodec.c
akashkumar0987d May 4, 2021
3ce5c66
Create OctaltoDec.c
akashkumar0987d May 4, 2021
65b6d39
Create HexatoDec.c
akashkumar0987d May 4, 2021
708ba2b
Create ShortestHextoDec.c
akashkumar0987d May 4, 2021
4130728
Create ShortestDectoHex.c
akashkumar0987d May 4, 2021
2d009c6
Create ShortestdectoOct.c
akashkumar0987d May 4, 2021
72192a5
Create ShortestOcttoDec.c
akashkumar0987d May 4, 2021
3b29e41
Create NotoRom.c
akashkumar0987d May 4, 2021
b09346f
Create octaltoDecima;.c
akashkumar0987d May 4, 2021
990e735
Rename OctaltoDec.c to OctaltoBinary.c
akashkumar0987d May 4, 2021
f12da4f
Create SumofNbyrecursion.c
akashkumar0987d May 4, 2021
b5defa5
Create SumofDigitbyRexursion.c
akashkumar0987d May 4, 2021
e336413
Add files via upload
akashkumar0987d May 4, 2021
9f9a2e4
Add files via upload
akashkumar0987d May 4, 2021
08ae9e7
Delete Grade_question.c
akashkumar0987d May 4, 2021
9a844de
Delete Noof1.c
akashkumar0987d May 4, 2021
5a6a83a
Delete Occurancesubaaray.c
akashkumar0987d May 4, 2021
1d43a36
Delete Question2.c
akashkumar0987d May 4, 2021
92afd62
Delete a.c
akashkumar0987d May 4, 2021
7959dd2
Delete candy.c
akashkumar0987d May 4, 2021
74a9adc
Delete d.c
akashkumar0987d May 4, 2021
806c552
Delete ip.c
akashkumar0987d May 4, 2021
42a836a
Delete leap_year.c
akashkumar0987d May 4, 2021
e2371f7
Delete next.c
akashkumar0987d May 4, 2021
f42a53c
Delete oddarray.c
akashkumar0987d May 4, 2021
478f082
Delete ood-or-even.c
akashkumar0987d May 4, 2021
3a8268b
Delete pointer_first.c
akashkumar0987d May 4, 2021
5dd0ec2
Delete pointer_second.c
akashkumar0987d May 4, 2021
eec9fc7
Delete pyramid.c
akashkumar0987d May 4, 2021
387a36c
Delete star.c
akashkumar0987d May 4, 2021
1875d35
Delete switch.c
akashkumar0987d May 4, 2021
46cb0b5
Delete switch1.c
akashkumar0987d May 4, 2021
be60ff3
Delete tempCodeRunnerFile.c
akashkumar0987d May 4, 2021
2ea7fe0
Delete triplet.c
akashkumar0987d May 4, 2021
872f74d
Delete Fib.c
akashkumar0987d May 4, 2021
8b2e275
Delete Greatest.c
akashkumar0987d May 4, 2021
f8e0936
Create q1.c
akashkumar0987d May 4, 2021
54989d4
Create q2.c
akashkumar0987d May 4, 2021
5a94937
Create q3.c
akashkumar0987d May 4, 2021
9334549
Create q4.c
akashkumar0987d May 4, 2021
549ac91
Create q5.c
akashkumar0987d May 4, 2021
673dc12
Create q6.c
akashkumar0987d May 4, 2021
48d86d7
Create q7.c
akashkumar0987d May 4, 2021
73bbb0c
Create q8.c
akashkumar0987d May 4, 2021
70be4f8
Create q9.c
akashkumar0987d May 4, 2021
8fb9b47
Create q10.c
akashkumar0987d May 4, 2021
3d0beb0
Create q11.c
akashkumar0987d May 4, 2021
04a6023
Create q12.c
akashkumar0987d May 4, 2021
ca0fa02
Update q12.c
akashkumar0987d May 4, 2021
b043032
Create q13.c
akashkumar0987d May 4, 2021
1770cb3
Update q13.c
akashkumar0987d May 4, 2021
5ed5b5a
Create q14.c
akashkumar0987d May 4, 2021
07b32bb
Create q15.c
akashkumar0987d May 4, 2021
300752a
Create q16.c
akashkumar0987d May 4, 2021
cdce484
Create q17.c
akashkumar0987d May 4, 2021
25f95e5
Create q18.c
akashkumar0987d May 4, 2021
751aee3
Create q19.c
akashkumar0987d May 4, 2021
25be325
Create q20.c
akashkumar0987d May 4, 2021
1c746de
Create q21.c
akashkumar0987d May 4, 2021
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
44 changes: 44 additions & 0 deletions Akash Kumar/2ndlargest.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#include<stdio.h>

int main()
{
int a,b,d;
int c =0;
scanf("%d %d",&a,&b);

if(a>b)
{
c=b;

}
if(b>a)
{
c=a;
a=b;
b=c;
}

for(;;)
{
scanf("%d",&b);
if(b==-1)
{
printf("%d",c);
break;
}

if(b>a)
{
c=a;
a=b;
}
if(b>c && b<a)
{
c =b;
}

}


return 0;
}
25 changes: 25 additions & 0 deletions Akash Kumar/BinarybyRecursion.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include <stdio.h>

int binary_conversion(int);

int main()
{
int num, bin;

printf("Enter a decimal number: ");
scanf("%d", &num);
bin = binary_conversion(num);
printf("The binary equivalent of %d is %d\n", num, bin);
}

int binary_conversion(int num)
{
if (num == 0)
{
return 0;
}
else
{
return (num % 2) + 10 * binary_conversion(num / 2);
}
}
18 changes: 18 additions & 0 deletions Akash Kumar/BinarytoOctal.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <stdio.h>

int main()
{
long int binarynum, octalnum = 0, j = 1, remainder;

printf("Enter the value for binary number: ");
scanf("%ld", &binarynum);
while (binarynum != 0)
{
remainder = binarynum % 10;
octalnum = octalnum + remainder * j;
j = j * 2;
binarynum = binarynum / 10;
}
printf("Equivalent octal value: %lo", octalnum);
return 0;
}
18 changes: 18 additions & 0 deletions Akash Kumar/BintoHexa.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <stdio.h>

int main()
{
long int binary, hexadecimalval = 0, i = 1, remainder;

printf("Enter the binary number: ");
scanf("%ld", &binary);
while (binaryval != 0)
{
remainder = binary % 10;
hexadecimalval = hexadecimalval + remainder * i;
i = i * 2;
binary = binary / 10;
}
printf("Equivalent hexadecimal value: %lX", hexadecimalval);
return 0;
}
49 changes: 49 additions & 0 deletions Akash Kumar/CollatzFunction.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* The Collatz function is defined for a positive integer n as follows.

f(n) = 3n+1 if n is odd

= n/2 if n is even
= 1 if n=1


We consider the repeated application of the Collatz function starting with a given integer n, as follows:

f(n), f(f(n)), f(f(f(n))), …


It is conjectured that no matter which positive integer n you start from, this sequence eventually will have 1 in it. It has been verified to hold for numbers up to 5 × 260 [Wikipedia: Collatz Conjecture]. */

#include <stdio.h>
int x =0;
void collatz_repeat(int n)
{

if ( n == 1 )
{
if(x==0)
printf("1");
else
return;

}

else{
x=1;
if ( n % 2 == 1 ) {
printf("%d ",3*n+1 );
collatz_repeat(3*n+1);
}else{
printf("%d ",n/2);
collatz_repeat(n/2);
}
}
}


int main()
{
int n;
scanf("%d",&n);
collatz_repeat(n);
return 0;
}
26 changes: 26 additions & 0 deletions Akash Kumar/DecimaltoHexa.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <stdio.h>

int main()
{
long decimalnum, quotient, remainder;
int i, j = 0;
char hexadecimalnum[100];

printf("Enter decimal number: ");
scanf("%ld", &decimalnum);

quotient = decimalnum;

while (quotient != 0)
{
remainder = quotient % 16;
if (remainder < 10)
hexadecimalnum[j++] = 48 + remainder;
else
hexadecimalnum[j++] = 55 + remainder;
quotient = quotient / 16;
}
for (i = j; i >= 0; i--)
printf("%c", hexadecimalnum[i]);
return 0;
}
20 changes: 20 additions & 0 deletions Akash Kumar/DectoOctal.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <stdio.h>

int main()
{
long decimalnum, remainder, quotient;
int octalNumber[100], i = 1, j;

printf("Enter the decimal number: ");
scanf("%ld", &decimalnum);
quotient = decimalnum;
while (quotient != 0)
{
octalNumber[i++] = quotient % 8;
quotient = quotient / 8;
}
printf("Equivalent octal value of decimal no %d: ", decimalnum);
for (j = i - 1; j > 0; j--)
printf("%d", octalNumber[j]);
return 0;
}
115 changes: 115 additions & 0 deletions Akash Kumar/DeleteallaftercertainelementinLinkedList.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
/* You are given a sequence of integers terminated with a -1. The -1 is
not part of the input sequence.


Next, you are given a positive number N.

You have to create a linked list with the input sequence of integers
as entries. You can use the following structure.

struct node{
int data;
struct node *next;
};


Now, you have to delete all but the last N elements from the linked
list, and print the resulting list. (i.e. The resulting list will
consist of only the last N elements from the list.)


If N is longer than the length of the linked list, you must print -1.

While printing, the entries of the list must be separated by a single
space.

Sample Input
------------
3 4 5 6 -1
1

Sample Output
-------------
6
*/

#include <stdio.h>
#include <stdlib.h>
struct node {
int data;
struct node *next;
};
int list_length;
struct node* create_node ( int n )
{
struct node *new_node;
new_node = (struct node *) malloc ( sizeof(struct node) );
new_node->data = n;
new_node->next = NULL;
return new_node;
}
struct node* create_list ( struct node *head )
{
int number;
struct node *current_node, *new_node;
scanf("%d",&number);
if(number != -1){
head = create_node ( number );
current_node = head;
list_length++;
scanf ( "%d", &number );
while ( number != -1 ){
new_node = create_node ( number );
current_node->next = new_node;
list_length++;
current_node = new_node; /* advance to next node */
scanf ( "%d", &number );
}
}
return head;
}
/* Delete the first num nodes from the list */
struct node *delete_first ( int num, struct node *head )
{
int i=1;
struct node *current_node = head;
struct node *next_node;
while ( i <= num ) {
next_node = current_node->next;
free(current_node);
current_node = next_node;
i++;
}
head = current_node;
return head;
}
void print_list ( struct node *head )
{
struct node * current_node;
if ( head == NULL ){
return;
}
current_node = head;
while ( current_node != NULL ) {
printf ( "%d ", current_node->data );
current_node = current_node->next;
}
printf("\n");
return;
}
int main()
{
int number;
int pruned_length=0;
struct node *head;
head = create_list ( head );
scanf("%d", &pruned_length);
if(pruned_length > list_length){
printf ( "-1\n" );
return 0;
}else{
head=delete_first(list_length-pruned_length, head);
print_list(head);
}
return 0;
}
Loading