daily pastebin goal
56%
SHARE
TWEET

Untitled

a guest May 17th, 2018 109 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. float massimoarray (float x[],unsigned int n);
  2. float minimoarray (float x[],unsigned int n);
  3. float diffarray (float x[],unsigned int n) {
  4.     float min,max,diff;
  5.     min=minimoarray(x,n);
  6.     max=massimoarray(x,n);
  7.     diff=max-min;
  8.     return diff;
  9. }//diffarray
  10.  
  11.  
  12. float minorefloat (float a,float b,float c);
  13. float maggiorefloat (float a,float b,float c);
  14. float differenza (float a,float b,float c) {
  15.     float max,min,diff;
  16.     max=maggiorefloat(a,b,c);
  17.     min=minorefloat(a,b,c);
  18.     diff=(max-min);
  19.     return diff;
  20. }//differenza
  21.    
  22.  
  23. float maggiorefloat (float a,float b,float c) {
  24.     float max=0;
  25.     if ((a>b)&&(a>c)) max=a;
  26.     else if ((b>a)&&(b>c)) max=b;
  27.     else max=c;
  28.     return max;
  29. }//maggiorefloat
  30.    
  31.     float minimoarray (float x[],unsigned int n) {
  32.     unsigned int i;
  33.     float min;
  34.     min=x[0];
  35.     for(i=0;i<n;i++) {
  36.         if(x[i]<min) min=x[i];
  37.     }//for
  38.     return min;
  39. }//minimoarray
  40.  
  41. float massimoarray (float x[],unsigned int n) {
  42.     unsigned int i;
  43.     float max;
  44.     max=x[0];
  45.     for(i=0;i<n;i++) {
  46.         if(x[i]>max) max=x[i];
  47.     }//for
  48.     return max;
  49. }//massimoarray
RAW Paste Data
Top