Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
184f4bc
Merge pull request #289 from swaaz/master
swaaz Oct 4, 2021
a21929c
Merge pull request #291 from swaaz/master
swaaz Oct 4, 2021
538d9ab
Merge pull request #292 from nithinmahendran/master
swaaz Oct 4, 2021
d969a01
Merge pull request #293 from swaaz/hacktoberfest
swaaz Oct 4, 2021
d1ad197
Add files via upload
udaysk3 Oct 5, 2021
328d8f0
ADDED 77TH NEW PROGRAM
udaysk3 Oct 5, 2021
af9ebf7
ADDED 78TH NEW PROGRAM
udaysk3 Oct 5, 2021
81d8fc6
added 79th program
udaysk3 Oct 5, 2021
7bd939f
added 79th program
udaysk3 Oct 5, 2021
1b06c6c
comment
nireekshamn Oct 5, 2021
e11d4ed
Create Queues_Using_Linked_Lists.cpp
HemanthKumar8251 Oct 5, 2021
7a0c68a
Add files via upload
HemanthKumar8251 Oct 5, 2021
bda98c5
Update README.md
HemanthKumar8251 Oct 5, 2021
226939b
program added
nireekshamn Oct 5, 2021
491abba
program added
nireekshamn Oct 5, 2021
b1328a1
Merge pull request #297 from udaysk3/master
swaaz Oct 5, 2021
4c80dd4
Merge pull request #298 from udaysk3/HACKTOBERFEST-2021
swaaz Oct 5, 2021
fafa0bc
program added
nireekshamn Oct 5, 2021
e66eb92
Merge pull request #299 from HemanthKumar8251/master
swaaz Oct 5, 2021
4930f15
Merge branch 'master' into niree
swaaz Oct 5, 2021
5089ee3
Merge pull request #300 from nireekshamn/niree
swaaz Oct 5, 2021
3e19df9
Merge pull request #301 from nireekshamn/niree1
swaaz Oct 5, 2021
426c94b
Merge branch 'master' into niree2
swaaz Oct 5, 2021
1849a36
Merge pull request #302 from nireekshamn/niree2
swaaz Oct 5, 2021
56e5300
Merge pull request #303 from nireekshamn/niree3
swaaz Oct 5, 2021
f91dfe8
Merge pull request #304 from swaaz/master
swaaz Oct 5, 2021
86aa9fa
lol
carbonxx Oct 5, 2021
05fcd45
:P
carbonxx Oct 5, 2021
e516e6b
Merge pull request #307 from carbonxx/master
swaaz Oct 5, 2021
69a5f7c
Merge pull request #308 from swaaz/hacktoberfest
swaaz Oct 5, 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
File renamed without changes.
File renamed without changes.
82 changes: 82 additions & 0 deletions C++/Program_25/Queues_Using_Linked_Lists.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
//Queues Using Linked List
#include<iostream>
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"<<endl;
else{
t->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!"<<endl;
else{
front = p->link;
x = p->data;
delete p;
}
return x;
}

void display(){
node *p=front;
while(p){
cout<<p->data<<" ";
p = p->link;
}
cout<<endl;
}

int main(){
int x;
char c;
while(1){
cout<<"Choose an Operation : \n1.Enqueue\n2.Dequeue\n3.Display\n4.Exit"<<endl;
cin>>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 "<<x<<endl;
break;
case '3':
display();
break;
case '4':
return 0;
break;
default:
cout<<"Enter a valid option :("<<endl;
break;
}
}

return 0;
}
1 change: 1 addition & 0 deletions C++/Program_25/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Program to implement Queue DataStructure Using Linked Lists
1 change: 1 addition & 0 deletions C++/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
83 changes: 33 additions & 50 deletions C/program-61/program.c
Original file line number Diff line number Diff line change
@@ -1,58 +1,41 @@
/*
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 <stdio.h>
#include <stdlib.h>
//C Program For Bubble Sort In Ascending And Descending Order//

char primecheck(int);
#include<stdio.h>

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;
}

int array[100], n, c, d, swap;

char primecheck(int num)
{
int i;
if (num == 0 || num == 1)
return 'n';
else
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++)
{
for(i=(num-1);i>1;i--)
{
if(num%i == 0)
{
return 'n';
}
else
continue;
}
return 'y';
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;

15 changes: 15 additions & 0 deletions C/program-74/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include<stdio.h>
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;
}
1 change: 1 addition & 0 deletions C/program-74/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
C Program to reverse a given number
51 changes: 51 additions & 0 deletions C/program-77/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include <stdio.h>

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;
}
1 change: 1 addition & 0 deletions C/program-77/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
C program to multiply matrices
24 changes: 24 additions & 0 deletions C/program-78/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include<stdio.h>

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;
}
1 change: 1 addition & 0 deletions C/program-78/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
C Program to find the Area of Triangle using Base and Height
22 changes: 22 additions & 0 deletions C/program-79/program.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include<stdio.h>

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;
}
1 change: 1 addition & 0 deletions C/program-79/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
C Program to calculate Simple Interest
58 changes: 58 additions & 0 deletions C/program-80/program.c
Original file line number Diff line number Diff line change
@@ -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 <stdio.h>
#include <stdlib.h>

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';
}

}
Loading