#include <stdio.h> int main() { int n; scanf("%d",&n); int arr[100]; int max = 0; int min = 100; for(int i = 0;i<n;i++){ scanf("%d",&arr[i]); if(arr[i]>max){ max = arr[i]; } if(arr[i]<min){ min = arr[i]; } } printf("%d",max-min); return 0; }
#include <stdio.h> int main() { int n; scanf("%d",&n); int arr[100]; int max = 0; int min = 100; for(int i = 0;i<n;i++){ scanf("%d",&arr[i]); if(arr[i]>max){ max = arr[i]; } if(arr[i]<min){ min = arr[i]; } } printf("%d",max-min); return 0; }