Lab exp.no – 13 // implement Queue insertion and deletion #include<stdio.h> int Queue[25]; int Rear=0,Front=0; void insert(int item,int n){ Queue[Rear]=item; printf("Item %d inserted.\n",item); Rear++; } void delete(){ int item=Queue[Front]; printf("Item = %d deleted.\n",item); Front++; } void display(){ int i; for(i=Front;i<Rear;i++){ printf("%d ",Queue[i]); } } int main(){ int n,i=0; printf("Enter how many elements you have : "); scanf("%d",&n); int x; while(i<n){ printf("Enter %d item : ",i+1); scanf("%d",&x); insert(x,n); i++; } printf("The Queue is ::::::::\n"); display(); int y; printf("\nEnter 1 or 2 accordingly:- \nA). 1 if you want perform INSERTION \nB). 2 if you want to perform DELETION\n"); scanf("%d",&y); if(y==1){ int z,k=0; printf("Enter how many elements you want to insert : "); scanf("%d",&z); while(i<n+z){ int item; printf("Enter the %d item you want to insert : ",k+1); scanf("%d",&item); insert(item,n+z); i++; k++; } printf("The Queue after Insertion is ::::::::\n"); display(); } else{ int j; printf("Enter how many elements you want to delete : "); scanf("%d",&j); while(j!=0){ delete(); j--; } printf("The Queue after deletion is :::::::::\n"); display(); } return 0; } Output:Enter how many elements you have : 5 Enter 1 item : 2 Item 2 inserted. Enter 2 item : 35 Item 35 inserted. Enter 3 item : 65 Item 65 inserted. Enter 4 item : 76 Item 76 inserted. Enter 5 item : 82 Item 82 inserted. The Queue is :::::::: 2 35 65 76 82 Enter 1 or 2 accordingly:A). 1 if you want perform INSERTION B). 2 if you want to perform DELETION 2 Enter how many elements you want to delete : 2 Item = 2 deleted. Item = 35 deleted. The Queue after deletion is ::::::::: 65 76 82 -------------------------------Process exited after 41.68 seconds with return value 0 Press any key to continue . . . (written and verified by @ArpitPatel)