Skip to main content

Posts

Showing posts from February, 2020

Write a program in foxpro to generate fibonacci series.

                            Ans:- Input"Enter the last term of fibonacci series:-"to num a=0 b=1 i=1 ?a do while(i<=num) c=a+b a=b b=c ?a i=i+1 enddo

Write a data structure program to make an array as stack.

Ans:- #include<stdio.h> #define MAX 10 int st[MAX],top=-1; void push(int st[],int val); int pop(int st[]); void display(int st[]); int main() { int val,option; do { printf("\n *****MAIN MENU*****"); printf("\n 1. PUSH"); printf("\n 2. POP"); printf("\n 3. DISPLAY"); printf("\n 4. EXIT"); printf("\n***************"); printf("\n enter your option:"); scanf("%d",&option); switch(option) { case 1: printf("\n Enter the number to be pushed on the stack:"); scanf("%d",&val); push(st,val); break; case 2: val = pop(st); if(val!=-1) printf("\n The value deleted from the stack is:%d",val); break; case 3: display(st); break;   } } while(option!=5); getch(); return 0; } void push(int st[],int val) { if(top==MAX-1) { printf("\n STACK OVERF...

Write a program to operate on linked list.All possible operation are performed through separate functions.

#include<stdio.h> #include<malloc.h> struct node { int data; struct node *next; }; struct node *start=NULL; struct node *create_11(struct node *); struct node *display(struct node *); struct node *insert_beg(struct node *); struct node *insert_end(struct node *); struct node *insert_before(struct node *); struct node *insert_after(struct node *); struct node *delete_beg(struct node *); struct node *delete_end(struct node *); struct node *delete_node(struct node *); struct node *delete_after(struct node *); struct node *delete_list(struct node *); struct node *sort_list(struct node *); int main() { int option; do { printf("\n\n *****MAIN MENU*****"); printf("\n1:Create a list"); printf("\n2:Display the list"); printf("\n3:Add a node at the beginning"); printf("\n4:Add a node at the end"); printf("\n5:Add a before a given node"); printf("\n6:Add a node after a g...