Advertisement
kalin729

stili

Jan 24th, 2023
893
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | Source Code | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. int main (){
  5.     int arr_size = 3;
  6.     int nums[arr_size];
  7.  
  8.     for(int i = 0; i < arr_size; i++){
  9.         do{
  10.             cout << i << " :";
  11.             cin >> nums[i];
  12.         }while (nums[i]<99 || nums[i]>1000);
  13.     }
  14.  
  15.     for(int i = 0; i < arr_size; i++){
  16.         int curr, ed, des, stot;
  17.         curr = nums[i];
  18.         ed = curr % 10;
  19.         curr /= 10;
  20.         des = curr % 10;
  21.         curr /= 10;
  22.         stot = curr % 10;
  23.        
  24.         if (ed + stot == des)
  25.         {
  26.             cout << nums[i] << endl;
  27.         }
  28.        
  29.     }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement