Missing NumberCode CrazeFeb 9, 20231 min read#include <stdio.h>int main() { int size; printf("\nEnter the size : "); scanf("%d",&size); int a[size]; int i=0,sum=0,n,msng_no; n=size+1; for(i=0;i<size;i++) { printf("\nEnter element : "); scanf("%d",&a[i]); } printf("\nArray elements\n"); for(i=0;i<size;i++) { printf("%d ",a[i]); } for(i=0;i<size;i++) { sum=sum+a[i]; } msng_no=(n*(n+1))/2 - sum; printf("\nMissing Number : %d",msng_no); }
Stack Using QueueA stack can be implemented using two queues in C. The basic idea is to use one queue for enqueue operations and another for dequeue...
Queue Using StackA queue can be implemented using two stacks in C. The basic idea is to use one stack for enqueue operations and another for dequeue...
Queue Using Array#include <stdio.h> #include<stdlib.h> #include<math.h> #define size 5 int queue[size]; int front = -1; int rear = -1; void enque(void);...
Commenti