Advertisement
Guest User

Untitled

a guest
Oct 13th, 2015
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. int func(int a, int &b){
  2.  
  3.     int aux;
  4.    
  5.     if(a > b){
  6.         aux = a;
  7.         a = b;
  8.         b = aux;   
  9.     }
  10.    
  11.     int cont = 0;
  12.     while(cont < 3){
  13.         a = a * 2;
  14.         cont = cont + 1;   
  15.     }
  16.  
  17.     if(b%3 == 0)
  18.         b = b + 1;
  19.     else
  20.         b = b - 1;
  21.    
  22.     resp = a + b;
  23.    
  24.     a = 20;
  25.    
  26.     return resp;   
  27. }
  28.  
  29. int main(){
  30.  
  31.     int x, y, z;
  32.    
  33.     x = 8;
  34.     y = 6;
  35.    
  36.     z = func(x, y);
  37.    
  38.     cout << "X = " << x << endl;
  39.     cout << "Y = " << y << endl;
  40.     cout << "Z = " << z << endl;
  41.  
  42.     return 0;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement