that_one_nigga_you_k

teste de subtração

Jun 30th, 2021
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6.     int a[2020];
  7.     int b[2021];
  8.  
  9.     a[0] = 5;
  10.     a[1]= 2;
  11.     a[2]= 5;
  12.     a[3]= 0;
  13.  
  14.     b[0]=3;
  15.     b[1]=2;
  16.     b[2]=8;
  17.     b[3]=1;
  18.  
  19.     /*for(int i = 0; i <3; i++){
  20.         a[i] = i+1;
  21.         b[i] = 3-i;
  22.     }
  23.  
  24.     for(int i = 0; i <3; i++){
  25.        cout<< a[i];
  26.        
  27.     }
  28.  
  29.     cout<<"\n";
  30.  
  31.     for(int i = 0; i <3; i++){
  32.        cout<< b[i];
  33.        
  34.     }*/
  35.  
  36.     cout<<"\n";
  37.  
  38.     if(a[3] == 0 || b[3]==1){
  39.          for (int i =2;  i>=0 ; i--){
  40.                         a[i]=a[i]-b[i];
  41.  
  42.                         if(a[i]<0){
  43.                             a[i] = a[i]+10;
  44.                             a[i-1] = a[i-1]-1;
  45.                         }
  46.                        
  47.                    
  48.  
  49.         }
  50.  
  51.     }
  52.  
  53.     for(int i = 0; i<3;i++){
  54.         cout<<a[i]<<" ";
  55.     }
  56. }
Add Comment
Please, Sign In to add comment