#include <stdio.h> #include <stdlib.h> void findMin(int n); void findMax(int n); int main() { int arr[10]; int min=arr[0], minind=0; int max=arr[0],maxind=0; for(int i=0;i<=9;i++) { printf("please enter element %d: ",i+1); scanf("%d",&arr[i]); } for(int i=1;i<=9;i++) { if(arr[i]>max) { max=arr[i]; maxind=i; } if(arr[i]<min) { min=arr[i]; minind=i; } } printf("maximum number of the array is %d at index %d\n: ",max,maxind); printf("\nminimum number of the array is %d at index %d\n: ",min,minind); 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