dontcare_hi

Untitled

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