From d1ad1976703aa294157e4eadf1f074a9b1777d82 Mon Sep 17 00:00:00 2001 From: UdaySantoshKumar <75845600+udaysk3@users.noreply.github.com> Date: Tue, 5 Oct 2021 20:42:08 +0530 Subject: [PATCH 01/14] Add files via upload --- C/program-74/program.c | 15 +++++++++++++++ C/program-74/readme.md | 1 + 2 files changed, 16 insertions(+) create mode 100644 C/program-74/program.c create mode 100644 C/program-74/readme.md diff --git a/C/program-74/program.c b/C/program-74/program.c new file mode 100644 index 00000000..0c61fc16 --- /dev/null +++ b/C/program-74/program.c @@ -0,0 +1,15 @@ +#include + int main() +{ +int n, reverse=0, rem; +printf("Enter a number: "); + scanf("%d", &n); + while(n!=0) + { + rem=n%10; + reverse=reverse*10+rem; + n/=10; + } + printf("Reversed Number: %d",reverse); +return 0; +} \ No newline at end of file diff --git a/C/program-74/readme.md b/C/program-74/readme.md new file mode 100644 index 00000000..abdd17c1 --- /dev/null +++ b/C/program-74/readme.md @@ -0,0 +1 @@ +C Program to reverse a given number \ No newline at end of file From 328d8f0215d54313b96a2a6619fd4c8bb37df014 Mon Sep 17 00:00:00 2001 From: UdaySantoshKumar <75845600+udaysk3@users.noreply.github.com> Date: Tue, 5 Oct 2021 20:49:44 +0530 Subject: [PATCH 02/14] ADDED 77TH NEW PROGRAM --- C/program-77/program.c | 51 ++++++++++++++++++++++++++++++++++++++++++ C/program-77/readme.md | 1 + 2 files changed, 52 insertions(+) create mode 100644 C/program-77/program.c create mode 100644 C/program-77/readme.md diff --git a/C/program-77/program.c b/C/program-77/program.c new file mode 100644 index 00000000..7dcefe58 --- /dev/null +++ b/C/program-77/program.c @@ -0,0 +1,51 @@ +#include + +int main() +{ +int m, n, p, q, c, d, k, sum = 0; +int mat1[10][10], mat2[10][10], mat3[10][10]; + +printf(“Enter number of rows and columns of mat1 matrix\n”); +scanf(“%d%d”, &m, &n); +printf(“Enter elements of matrix 1\n”); + +for (c = 0; c < m; c++) +for (d = 0; d < n; d++) +scanf(“%d”, &mat1[c][d]); + +printf(“\nEnter number of rows and columns of mat2 matrix\n”); +scanf(“%d%d”, &p, &q); + +if (n != p) +printf(“\nThe matrices can’t be multiplied with each other.\n”); +else +{ +printf(“\nEnter elements of matrix2\n”); + +for (c = 0; c < p; c++) +for (d = 0; d < q; d++) +scanf(“%d”, &mat2[c][d]); + +for (c = 0; c < m; c++) { +for (d = 0; d < q; d++) { +for (k = 0; k < p; k++) { +sum = sum + mat1[c][k]*mat2[k][d]; +} + +mat3[c][d] = sum; +sum = 0; +} +} + +printf(“\nProduct of the matrices:\n”); + +for (c = 0; c < m; c++) { +for (d = 0; d < q; d++) +printf(“%d\t”, mat3[c][d]); + +printf(“\n”); +} +} + +return 0; +} \ No newline at end of file diff --git a/C/program-77/readme.md b/C/program-77/readme.md new file mode 100644 index 00000000..41afd4c7 --- /dev/null +++ b/C/program-77/readme.md @@ -0,0 +1 @@ +C program to multiply matrices \ No newline at end of file From af9ebf743ec45651ce1292c7c12ad1c4abcbab78 Mon Sep 17 00:00:00 2001 From: UdaySantoshKumar <75845600+udaysk3@users.noreply.github.com> Date: Tue, 5 Oct 2021 20:50:51 +0530 Subject: [PATCH 03/14] ADDED 78TH NEW PROGRAM --- C/program-78/program.c | 24 ++++++++++++++++++++++++ C/program-78/readme.md | 1 + 2 files changed, 25 insertions(+) create mode 100644 C/program-78/program.c create mode 100644 C/program-78/readme.md diff --git a/C/program-78/program.c b/C/program-78/program.c new file mode 100644 index 00000000..c82cb20b --- /dev/null +++ b/C/program-78/program.c @@ -0,0 +1,24 @@ +#include + +int main() +{ + printf("\n\n\t\tStudytonight - Best place to learn\n\n\n"); + int h, b; + float area; + printf("\n\nEnter the height of the Triangle: "); + scanf("%d", &h); + printf("\n\nEnter the base of the Triangle: "); + scanf("%d", &b); + + /* + Formula for the area of the triangle = (height x base)/2 + + Also, typecasting denominator from int to float + to get the output in float + */ + area = (h*b)/(float)2; + printf("\n\n\nThe area of the triangle is: %f", area); + + printf("\n\n\t\t\tCoding is Fun !\n\n\n"); + return 0; +} \ No newline at end of file diff --git a/C/program-78/readme.md b/C/program-78/readme.md new file mode 100644 index 00000000..e8e927d0 --- /dev/null +++ b/C/program-78/readme.md @@ -0,0 +1 @@ +C Program to find the Area of Triangle using Base and Height \ No newline at end of file From 81d8fc6803ff82eafe6127c843d66565505ae490 Mon Sep 17 00:00:00 2001 From: UdaySantoshKumar <75845600+udaysk3@users.noreply.github.com> Date: Tue, 5 Oct 2021 20:53:23 +0530 Subject: [PATCH 04/14] added 79th program --- C/program-79/program.c | 22 ++++++++++++++++++++++ C/program-79/readme.md | 1 + 2 files changed, 23 insertions(+) create mode 100644 C/program-79/program.c create mode 100644 C/program-79/readme.md diff --git a/C/program-79/program.c b/C/program-79/program.c new file mode 100644 index 00000000..1a3a9094 --- /dev/null +++ b/C/program-79/program.c @@ -0,0 +1,22 @@ +#include + +void main() +{ + printf("\n\n\t\tStudytonight - Best place to learn\n\n\n"); + float principal_amt, rate, simple_interest; + int time; + printf("Enter the value of principal amount, rate and time\n\n\n"); + scanf("%f%f%d", &principal_amt, &rate, &time); + + // considering rate is in percentage + simple_interest = (principal_amt*rate*time)/100.0; + + // usually used to align text in form of columns in table + printf("\n\n\t\t\tAmount = Rs.%7.3f\n ", principal_amt); + + printf("\n\n\t\t\tRate = Rs.%7.3f\n ", rate); + printf("\n\n\t\t\tTime= %d years \n", time); + printf("\n\n\t\t\tSimple Interest = Rs.%7.3f\n ", simple_interest); + printf("\n\n\t\t\tCoding is Fun !\n\n\n"); + return 0; +} \ No newline at end of file diff --git a/C/program-79/readme.md b/C/program-79/readme.md new file mode 100644 index 00000000..ec5e5b99 --- /dev/null +++ b/C/program-79/readme.md @@ -0,0 +1 @@ +C Program to calculate Simple Interest \ No newline at end of file From 7bd939f8e9586c6aabfd1889ce17354b666c5172 Mon Sep 17 00:00:00 2001 From: UdaySantoshKumar <75845600+udaysk3@users.noreply.github.com> Date: Tue, 5 Oct 2021 20:53:54 +0530 Subject: [PATCH 05/14] added 79th program --- C/program-79/program.c | 22 ++++++++++++++++++++++ C/program-79/readme.md | 1 + 2 files changed, 23 insertions(+) create mode 100644 C/program-79/program.c create mode 100644 C/program-79/readme.md diff --git a/C/program-79/program.c b/C/program-79/program.c new file mode 100644 index 00000000..1a3a9094 --- /dev/null +++ b/C/program-79/program.c @@ -0,0 +1,22 @@ +#include + +void main() +{ + printf("\n\n\t\tStudytonight - Best place to learn\n\n\n"); + float principal_amt, rate, simple_interest; + int time; + printf("Enter the value of principal amount, rate and time\n\n\n"); + scanf("%f%f%d", &principal_amt, &rate, &time); + + // considering rate is in percentage + simple_interest = (principal_amt*rate*time)/100.0; + + // usually used to align text in form of columns in table + printf("\n\n\t\t\tAmount = Rs.%7.3f\n ", principal_amt); + + printf("\n\n\t\t\tRate = Rs.%7.3f\n ", rate); + printf("\n\n\t\t\tTime= %d years \n", time); + printf("\n\n\t\t\tSimple Interest = Rs.%7.3f\n ", simple_interest); + printf("\n\n\t\t\tCoding is Fun !\n\n\n"); + return 0; +} \ No newline at end of file diff --git a/C/program-79/readme.md b/C/program-79/readme.md new file mode 100644 index 00000000..ec5e5b99 --- /dev/null +++ b/C/program-79/readme.md @@ -0,0 +1 @@ +C Program to calculate Simple Interest \ No newline at end of file From 1b06c6ce0d3cb9218f2e9c6123346f37b28d5180 Mon Sep 17 00:00:00 2001 From: Nireeksha Date: Tue, 5 Oct 2021 22:31:53 +0530 Subject: [PATCH 06/14] comment --- C/program-61/program.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 C/program-61/program.c diff --git a/C/program-61/program.c b/C/program-61/program.c new file mode 100644 index 00000000..f0b55ed4 --- /dev/null +++ b/C/program-61/program.c @@ -0,0 +1,41 @@ +//C Program For Bubble Sort In Ascending And Descending Order// + +#include + +int main() +{ + + int array[100], n, c, d, swap; + + printf("Enter number of elements\n"); + scanf("%d", &n); + + printf("Enter %d integers\n", n); + + for (c = 0; c < n; c++) + scanf("%d", &array[c]); + + for (c = 0 ; c < ( n - 1 ); c++) + { + for (d = 0 ; d < n - c - 1; d++) + { + if (array[d] > array[d+1]) + { + swap = array[d]; + array[d] = array[d+1]; + array[d+1] = swap; + } + } + } + + printf("Sorted list in ascending order:\n"); + + for ( c = 0 ; c < n ; c++ ) + printf("%d\n", array[c]); + + printf("\nSorted list in descending order:\n"); + + for ( c = n-1 ; c >= 0; c-- ) + printf("%d\n", array[c]); + return 0; +} \ No newline at end of file From e11d4ed76ae4fa9b73c54932195c6ecde1f0a135 Mon Sep 17 00:00:00 2001 From: HemanthKumar8251 <85030810+HemanthKumar8251@users.noreply.github.com> Date: Tue, 5 Oct 2021 22:33:12 +0530 Subject: [PATCH 07/14] Create Queues_Using_Linked_Lists.cpp --- C++/Program_25/Queues_Using_Linked_Lists.cpp | 82 ++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 C++/Program_25/Queues_Using_Linked_Lists.cpp diff --git a/C++/Program_25/Queues_Using_Linked_Lists.cpp b/C++/Program_25/Queues_Using_Linked_Lists.cpp new file mode 100644 index 00000000..65cbca63 --- /dev/null +++ b/C++/Program_25/Queues_Using_Linked_Lists.cpp @@ -0,0 +1,82 @@ +//Queues Using Linked List +#include +using namespace std; + +class node{ + public: + int data; + node *link; +}*front=NULL,*rear=NULL; + +void enqueue(int x){ + node *t; + t = new node; + if(t==NULL) + cout<<"Queue is Full"<data = x; + t->link = NULL; + } + if(front==NULL){ + front = rear = t; + } + else{ + rear->link=t; + rear = t; + } +} + +int dequeue(){ + node *p; + int x = -1; + if(front==NULL) + cout<<"Queue is Empty!"<link; + x = p->data; + delete p; + } + return x; +} + +void display(){ + node *p=front; + while(p){ + cout<data<<" "; + p = p->link; + } + cout<>c; + switch (c) + { + case '1': + cout<<"Enter the element : "; + cin>>x; + enqueue(x); + break; + case '2': + x=dequeue(); + if(x!=-1) + cout<<"Deleted element is "< Date: Tue, 5 Oct 2021 22:34:12 +0530 Subject: [PATCH 08/14] Add files via upload --- C++/Program_25/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 C++/Program_25/README.md diff --git a/C++/Program_25/README.md b/C++/Program_25/README.md new file mode 100644 index 00000000..9f24ccab --- /dev/null +++ b/C++/Program_25/README.md @@ -0,0 +1 @@ +Program to implement Queue DataStructure Using Linked Lists \ No newline at end of file From bda98c5245f6162ac98cddfa4a8dbc7a0a0b7bf8 Mon Sep 17 00:00:00 2001 From: HemanthKumar8251 <85030810+HemanthKumar8251@users.noreply.github.com> Date: Tue, 5 Oct 2021 22:49:44 +0530 Subject: [PATCH 09/14] Update README.md --- C++/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/C++/README.md b/C++/README.md index 922575d5..de6ed221 100644 --- a/C++/README.md +++ b/C++/README.md @@ -14,3 +14,4 @@ | Program-15 | Program to find modular exponentiation. | Program-19| To check whether a number is in palindrome or not | Program-24 | Program to convert Hexa-Decimal number to Decimal number +| Program-25 | Program to Implement Queue Data Structure Using Linked Lists From 226939b222f88de0b4dd698a0d7be82efaaa7a5f Mon Sep 17 00:00:00 2001 From: Nireeksha Date: Tue, 5 Oct 2021 22:54:54 +0530 Subject: [PATCH 10/14] program added --- Python/program-5/program.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Python/program-5/program.py diff --git a/Python/program-5/program.py b/Python/program-5/program.py new file mode 100644 index 00000000..0b2242ab --- /dev/null +++ b/Python/program-5/program.py @@ -0,0 +1,10 @@ +rows = int(input("Enter Same Number Rows & Columns Square Pattern Rows = ")) + +print("===Printing Same Number in Rows and Columns of a Square Pattern===") + +for i in range(1, rows + 1): + for j in range(i, rows + 1): + print(j, end = ' ') + for k in range(1, i): + print(k, end = ' ') + print() \ No newline at end of file From 491abba43169e08460b6b2c0025eb3517988703f Mon Sep 17 00:00:00 2001 From: Nireeksha Date: Tue, 5 Oct 2021 23:07:52 +0530 Subject: [PATCH 11/14] program added --- Java/program-3/program.java | 58 +++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Java/program-3/program.java diff --git a/Java/program-3/program.java b/Java/program-3/program.java new file mode 100644 index 00000000..5a5c9233 --- /dev/null +++ b/Java/program-3/program.java @@ -0,0 +1,58 @@ +//Java Program to Find Transpose of a Matrix// + + + + + + +import java.util.Arrays; + +public class Matrix { + + // main method + public static void main(String[] args) { + + // declare and initialize a matrix + int a[][] = { { 1, 2 }, { 8, 9 } }; + + // find row and column size + int row = a.length; + int column = a[0].length; + + // declare new matrix to store result + int transpose[][] = new int[row][column]; + + // Transpose of matrix + transpose = transposeMatrix(a); + + // display all matrices + System.out.println("A = " + Arrays.deepToString(a)); + System.out.println("Transpose = " + + Arrays.deepToString(transpose)); + } + + // method to calculate the transpose of a matrix + public static int[][] transposeMatrix(int[][] a) { + + // calculate row and column size + int row = a.length; + int column = a[0].length; + + // declare a matrix to store resultant + int temp[][] = new int[row][column]; + + // calculate transpose of matrix + // outer loop for row + for (int i = 0; i < row; i++) { + // inner loop for column + for (int j = 0; j < column; j++) { + // formula + temp[i][j] = a[j][i]; + } + } + + // return resultant matrix + return temp; + } + +} \ No newline at end of file From fafa0bcd48774e359ae0474c91a3c508a711975c Mon Sep 17 00:00:00 2001 From: Nireeksha Date: Tue, 5 Oct 2021 23:14:41 +0530 Subject: [PATCH 12/14] program added --- Javascript/program-7/program.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Javascript/program-7/program.js diff --git a/Javascript/program-7/program.js b/Javascript/program-7/program.js new file mode 100644 index 00000000..ee78770a --- /dev/null +++ b/Javascript/program-7/program.js @@ -0,0 +1,17 @@ +// program to sort words in alphabetical order + +// take input +const string = prompt('Enter a sentence: '); + +// converting to an array +const words = string.split(' '); + +// sort the array elements +words.sort(); + +// display the sorted words +console.log('The sorted words are:'); + +for (const element of words) { + console.log(element); +} \ No newline at end of file From 86aa9fa0cb719026e0a838474643b52a08f02451 Mon Sep 17 00:00:00 2001 From: carbonxx Date: Tue, 5 Oct 2021 23:46:06 +0530 Subject: [PATCH 13/14] lol --- C++/{Program -1 => Program-01}/Program.cpp | 0 C++/{Program -1 => Program-01}/README.md | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename C++/{Program -1 => Program-01}/Program.cpp (100%) rename C++/{Program -1 => Program-01}/README.md (100%) diff --git a/C++/Program -1/Program.cpp b/C++/Program-01/Program.cpp similarity index 100% rename from C++/Program -1/Program.cpp rename to C++/Program-01/Program.cpp diff --git a/C++/Program -1/README.md b/C++/Program-01/README.md similarity index 100% rename from C++/Program -1/README.md rename to C++/Program-01/README.md From 05fcd453aa45a65cdae60ab89c35904e9708ea50 Mon Sep 17 00:00:00 2001 From: carbonxx Date: Tue, 5 Oct 2021 23:55:05 +0530 Subject: [PATCH 14/14] :P --- C/program-61/program.c | 59 ------------------------------------------ C/program-80/program.c | 58 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 59 deletions(-) create mode 100644 C/program-80/program.c diff --git a/C/program-61/program.c b/C/program-61/program.c index 0f343960..d298b9f3 100644 --- a/C/program-61/program.c +++ b/C/program-61/program.c @@ -39,62 +39,3 @@ int main() printf("%d\n", array[c]); return 0; - -/* - This Program calulates all the prime between the range of numbers - includes the numbers which is provided. - - For e.g: 2 7 - Prime Numbers are : 2 3 5 7 -*/ - -#include -#include - -char primecheck(int); - -int main() -{ - int i,num1,num2,cases; - char ans; - printf("Enter Number of Test Cases: "); - scanf("%d",&cases); - while (cases--) - { - printf("Enter First Number: "); - scanf("%d",&num1); - printf("Enter Second Number: "); - scanf("%d",&num2); - - printf("Answer: "); - for(i=num1;i<=num2;i++) - { - ans = primecheck(i); - if (ans == 'y') - printf("%d ",i); - } - printf("\n"); - } - return 0; -} - -char primecheck(int num) -{ - int i; - if (num == 0 || num == 1) - return 'n'; - else - { - for(i=(num-1);i>1;i--) - { - if(num%i == 0) - { - return 'n'; - } - else - continue; - } - return 'y'; - } - -} \ No newline at end of file diff --git a/C/program-80/program.c b/C/program-80/program.c new file mode 100644 index 00000000..ca8f1a80 --- /dev/null +++ b/C/program-80/program.c @@ -0,0 +1,58 @@ +/* + This Program calulates all the prime between the range of numbers + includes the numbers which is provided. + + For e.g: 2 7 + Prime Numbers are : 2 3 5 7 +*/ + +#include +#include + +char primecheck(int); + +int main() +{ + int i,num1,num2,cases; + char ans; + printf("Enter Number of Test Cases: "); + scanf("%d",&cases); + while (cases--) + { + printf("Enter First Number: "); + scanf("%d",&num1); + printf("Enter Second Number: "); + scanf("%d",&num2); + + printf("Answer: "); + for(i=num1;i<=num2;i++) + { + ans = primecheck(i); + if (ans == 'y') + printf("%d ",i); + } + printf("\n"); + } + return 0; +} + +char primecheck(int num) +{ + int i; + if (num == 0 || num == 1) + return 'n'; + else + { + for(i=(num-1);i>1;i--) + { + if(num%i == 0) + { + return 'n'; + } + else + continue; + } + return 'y'; + } + +} \ No newline at end of file