Advertisement
Guest User

a) & b)

a guest
Mar 24th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void cmmogl ( int a, int b, int c, int d )
  5. {
  6. cout << "a = "; cin >> a;
  7. cout << "b = "; cin >> b;
  8. cout << "c = "; cin >> c;
  9. cout << "d = "; cin >> d;
  10.  
  11. int ogl = 0;
  12. int k[3];
  13. while ( a!=0) {
  14. ogl = ogl * 10 + a % 10;
  15. a = a /10;
  16. }
  17. k[0] = ogl;
  18. cout << ogl << " ";
  19.  
  20. ogl = 0;
  21. while ( b!=0) {
  22. ogl = ogl * 10 + b % 10;
  23. b = b /10;
  24. }
  25. k[1] = ogl;
  26. cout << ogl << " ";
  27. ogl = 0;
  28. while ( c!=0) {
  29. ogl = ogl * 10 + c % 10;
  30. c = c /10;
  31. }
  32. k[2] = ogl;
  33. cout << ogl << " ";
  34. ogl = 0;
  35.  
  36. while ( d!=0) {
  37. ogl = ogl * 10 + d % 10;
  38. d = d /10;
  39. }
  40. k[3] = ogl;
  41. cout << ogl << " ";
  42. cout << endl;
  43.  
  44. int maxim = k[0];
  45. for ( int i = 0; i < 3; i++ ) {
  46. if ( maxim < k[0] ) {
  47. maxim = k[i];
  48. }
  49. }
  50. cout << endl;
  51. cout << "Elementul maxim este: " << maxim;
  52.  
  53. int minim = k[0];
  54. for ( int i = 0; i < 3; i++ ) {
  55. if ( minim > k[0] ) {
  56. minim = k[i];
  57. }
  58. }
  59. cout << endl << endl << endl;
  60.  
  61. cout << "Elementul minim este: " << minim;
  62.  
  63. }
  64.  
  65.  
  66. int main(){
  67.  
  68. int a,b,c,d;
  69. cmmogl(a,b,c,d);
  70.  
  71.  
  72.  
  73.  
  74.  
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement