Code CrazeJun 21, 20231 min readLinear Search In C#include<stdio.h>void main(){ int size; printf("\nEnter the size of array : "); scanf("%d",&size); int a[size]; int i=0,e,count=0; for(i=0;i<size;i++) { printf("\nEnter element : "); scanf("%d",&a[i]); } printf("\nArray : "); for(i=0;i<size;i++) { printf("\t%d",a[i]); } printf("\nEnter element to search : "); scanf("%d",&e); for(i=0;i<size;i++) { if(e==a[i]) { count+=1; printf("\nElement found successfully🙂🙂🙂!"); } } if(count==0) { printf("\nSorry! element is not found😅😅😅!"); }}
#include<stdio.h>void main(){ int size; printf("\nEnter the size of array : "); scanf("%d",&size); int a[size]; int i=0,e,count=0; for(i=0;i<size;i++) { printf("\nEnter element : "); scanf("%d",&a[i]); } printf("\nArray : "); for(i=0;i<size;i++) { printf("\t%d",a[i]); } printf("\nEnter element to search : "); scanf("%d",&e); for(i=0;i<size;i++) { if(e==a[i]) { count+=1; printf("\nElement found successfully🙂🙂🙂!"); } } if(count==0) { printf("\nSorry! element is not found😅😅😅!"); }}
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 operations. When an element is pushed onto the stack, it is enqueued