dontcare_hi

Untitled

Jan 24th, 2022
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <algorithm>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int a, b, c, d, e, A, W, i;
  9. cout << "Enter Numbers a, b, c, d and e : " << endl;
  10. cin >> a >> b >> c >> d >> e;
  11. cout << "Entered number a is: " << a << endl;
  12. cout << "Entered number b is: " << b << endl;
  13. cout << "Entered number c is: " << c << endl;
  14. cout << "Entered number d is: " << d << endl;
  15. cout << "Entered number e is: " << e << endl;
  16.  
  17. int array[5] = {a, b, c, d, e};
  18. {
  19. int smallest = array[0] ;
  20. int biggest = array[0] ;
  21. for ( int i=1; i < sizeof(array)/sizeof(array[0]); ++i )
  22.  
  23.  
  24. if ( array[i] < smallest )
  25. {
  26. smallest = array[i] ;
  27. }
  28. cout << "Smallest number is: " << smallest << '\n' << endl;
  29.  
  30.  
  31. if ( array[i] > biggest )
  32. {
  33. biggest = array[i] ;
  34. }
  35. cout << "Biggest number is: " << biggest << '\n' << endl;
  36.  
  37.  
  38.  
  39. A = (a+b+c+d+e)/5;
  40. cout << "Arithmetic Mean A is: " << A << endl;
  41. W = (pow((a-A),2))+(pow((b-A),2))+(pow((c-A),2)),(pow((d-A),2))+((pow((e-A),2)))/5;
  42. cout << "variance of the array W is: " << W << endl;
  43.  
  44. return 0;
  45.  
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment