void findPeaks(int arr[],int n); int main() { int arr[10]; int i; int number; for(int i=0;i<10;i++) { printf("enter elment of the array %d: ",i+1); scanf("%d",&arr[i]); } for(int i=0;i<10;i++) { if(arr[i]>arr[i-1] && arr[i]>arr[i+1]) { printf("the value of %d at index %d is a peak\n",arr[i],i); } else printf("No peak\n"); } return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter