dontcare_hi

Untitled

Jan 24th, 2022
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 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. for ( int i=1; i < sizeof(array)/sizeof(array[0]); ++i )
  21. if ( array[i] < smallest )
  22. smallest = array[i] ;
  23. cout << smallest << '\n' << endl;
  24. if ( array[i] > biggest )
  25. smallest = array[i] ;
  26. cout <<biggest << '\n' << endl;
  27. }
  28.  
  29. A = (a+b+c+d+e)/5;
  30. cout << "Arithmetic Mean A is: " << A << endl;
  31. W = (pow((a-A),2))+(pow((b-A),2))+(pow((c-A),2)),(pow((d-A),2))+((pow((e-A),2)))/5;
  32. cout << "variance of the array W is: " << W << endl;
  33.  
  34. return 0;
  35.  
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment