Skip to content

fibonicci series #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 29 commits into
base: helloWorldNew
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c641fdf
hello world
Gaurav9876543210 Oct 12, 2019
69bc540
Added Print Func
1406-maker Oct 12, 2019
6caef7b
issue resolved
akashnagpal1123 Oct 12, 2019
df726dd
issue resolved
gauravv70 Oct 12, 2019
ed5847a
Update print pattern
pranshukatyal14 Oct 12, 2019
ee6cf52
Merge pull request #24 from pranshukatyal14/patch-1
siddharthnarula Oct 12, 2019
e646163
Create multiplicationofnumbers.cpp
muskgupta32 Oct 12, 2019
7f1e7a0
Merge branch 'master' into patch-1
siddharthnarula Oct 12, 2019
2c2e942
Merge pull request #12 from gaurav-budhiraja/patch-1
siddharthnarula Oct 12, 2019
e65a069
Merge branch 'master' into patch-1
siddharthnarula Oct 12, 2019
13a9e1a
Merge pull request #10 from akashnagpal1123/patch-1
siddharthnarula Oct 12, 2019
5e65c5d
Merge pull request #25 from 1234-sketch/master
siddharthnarula Oct 12, 2019
1455ef0
Merge branch 'master' into patch-1
siddharthnarula Oct 12, 2019
8ab3b3f
Swapping Of elements using Call by reference
akashnagpal1123 Oct 12, 2019
e4f1c1e
Merge branch 'master' into patch-1
siddharthnarula Oct 12, 2019
4bc16e5
Merge pull request #8 from Gaurav9876543210/patch-1
siddharthnarula Oct 12, 2019
89e3d24
Merge pull request #9 from 1406-maker/patch-1
siddharthnarula Oct 12, 2019
12470c5
Merge pull request #26 from akashnagpal1123/patch-2
siddharthnarula Oct 12, 2019
bd1df13
Add files via upload
PRUBHTEJ Oct 12, 2019
eadc32f
Add files via upload
PRUBHTEJ Oct 12, 2019
287e636
Add files via upload
PRUBHTEJ Oct 12, 2019
77caf86
Add files via upload
PRUBHTEJ Oct 12, 2019
e9ebb11
Merge pull request #27 from PRUBHTEJ/master
siddharthnarula Oct 12, 2019
f2ea72c
Add files via upload
PRUBHTEJ Oct 12, 2019
0c37d3e
Merge pull request #28 from PRUBHTEJ/master
siddharthnarula Oct 12, 2019
ccb277a
Add files via upload
PRUBHTEJ Oct 12, 2019
5f97f78
Add files via upload
PRUBHTEJ Oct 12, 2019
79af868
Add files via upload
PRUBHTEJ Oct 12, 2019
afa446d
Merge pull request #29 from PRUBHTEJ/master
siddharthnarula Oct 12, 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
86 changes: 86 additions & 0 deletions 11.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>

#define size 5
struct stack {
int s[size];
int top;
} st;

int stfull() {
if (st.top >= size - 1)
return 1;
else
return 0;
}

void push(int item) {
st.top++;
st.s[st.top] = item;
}

int stempty() {
if (st.top == -1)
return 1;
else
return 0;
}

int pop() {
int item;
item = st.s[st.top];
st.top--;
return (item);
}

void display() {
int i;
if (stempty())
printf("\nStack Is Empty!");
else {
for (i = st.top; i >= 0; i--)
printf("\n%d", st.s[i]);
}
}

int main() {
int item, choice;
char ans;
st.top = -1;

printf("\n\tImplementation Of Stack");
do {
printf("\nMain Menu");
printf("\n1.Push \n2.Pop \n3.Display \n4.exit");
printf("\nEnter Your Choice");
scanf("%d", &choice);
switch (choice) {
case 1:
printf("\nEnter The roll no to be pushed:");
scanf("%d", &item);
if (stfull())
printf("\nStack is Full!");
else
push(item);
break;
case 2:
if (stempty())
printf("\nEmpty stack!Underflow !!");
else {
item = pop();
printf("\nThe popped element is %d", item);
}
break;
case 3:
display();
break;
case 4:
exit(0);
}
printf("\nDo You want To Continue?");
ans = getche();
} while (ans == 'Y' || ans == 'y');

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



void insert();
void delete();
void display();
int queue_array[50];
int rear = - 1;
int front = - 1;
main()
{
int choice;
while (1)
{
printf("1.Insert employee numbers to queue \n");
printf("2.Delete employee numbers from queue \n");
printf("3.Display all employee numbers in queue \n");
printf("4.Quit \n");
printf("Enter your choice : ");
scanf("%d", &choice);
switch (choice)
{
case 1:
insert();
break;
case 2:
delete();
break;
case 3:
display();
break;
case 4:
exit(1);
default:
printf("Wrong choice \n");
} /* End of switch */
} /* End of while */
} /* End of main() */

void insert()
{
int add_item;
if (rear == 50 - 1)
printf("Queue Overflow \n");
else
{
if (front == - 1)
/*If queue is initially empty */
front = 0;
printf("Insert the employee number in queue : ");
scanf("%d", &add_item);
rear = rear + 1;
queue_array[rear] = add_item;
}
} /* End of insert() */

void delete()
{
if (front == - 1 || front > rear)
{
printf("Queue Underflow \n");
return ;
}
else
{
printf("Employee number deleted from queue is : %d\n", queue_array[front]);
front = front + 1;
}
} /* End of delete() */

void display()
{
int i;
if (front == - 1)
printf("Queue is empty \n");
else
{
printf("Queue is : \n");
for (i = front; i <= rear; i++)
printf("%d ", queue_array[i]);
printf("\n");
}
} /* End of display() */
138 changes: 138 additions & 0 deletions Q15.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
/* C Program to implement queue using circular linked list*/

#include<stdio.h>
#include<stdlib.h>

struct node
{
int info;
struct node *link;
}*rear=NULL;

void insert(int item);
int del();
void display();
int isEmpty();
int peek();

int main()
{
int choice,item;
while(1)
{
printf("\n1.Insert\n");
printf("2.Delete\n");
printf("3.Peek\n");
printf("4.Display\n");
printf("5.Quit\n");
printf("\nEnter your choice : ");
scanf("%d",&choice);

switch(choice)
{
case 1:
printf("\nEnter the element for insertion : ");
scanf("%d",&item);
insert(item);
break;
case 2:
printf("\nDeleted element is %d\n",del());
break;
case 3:
printf("\nItem at the front of queue is %d\n",peek());
break;
case 4:
display();
break;
case 5:
exit(1);
default:
printf("\nWrong choice\n");
}/*End of switch*/
}/*End of while*/
}/*End of main()*/

void insert(int item)
{
struct node *tmp;
tmp=(struct node *)malloc(sizeof(struct node));
tmp->info=item;
if(tmp==NULL)
{
printf("\nMemory not available\n");
return;
}

if( isEmpty() ) /*If queue is empty */
{
rear=tmp;
tmp->link=rear;
}
else
{
tmp->link=rear->link;
rear->link=tmp;
rear=tmp;
}
}/*End of insert()*/

del()
{
int item;
struct node *tmp;
if( isEmpty() )
{
printf("\nQueue underflow\n");
exit(1);
}
if(rear->link==rear) /*If only one element*/
{
tmp=rear;
rear=NULL;
}
else
{
tmp=rear->link;
rear->link=rear->link->link;
}
item=tmp->info;
free(tmp);
return item;
}/*End of del()*/

int peek()
{
if( isEmpty() )
{
printf("\nQueue underflow\n");
exit(1);
}
return rear->link->info;
}/* End of peek() */

int isEmpty()
{
if( rear == NULL )
return 1;
else
return 0;
}/*End of isEmpty()*/


void display()
{
struct node *p;
if(isEmpty())
{
printf("\nQueue is empty\n");
return;
}
printf("\nQueue is :\n");
p=rear->link;
do
{
printf("%d ",p->info);
p=p->link;
}while(p!=rear->link);
printf("\n");
}/*End of display()*/
Loading