josiftepe

Untitled

Jan 13th, 2021
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.34 KB | None | 0 0
  1.     #include <iostream>
  2.     using namespace std;
  3.  
  4.     int main()
  5.     {
  6.         int broj;
  7.         cin >> broj;
  8.         int posledna_cifra = broj % 10; // ostatok pri delenje na broj so 10
  9.         cout << posledna_cifra << endl;
  10.        
  11.         return 0;
  12.     }
  13. // 12345 / 10 = 1234, остаток 5
  14. // 67123 / 10 = 6712, остаток 3
  15.  
Advertisement
Add Comment
Please, Sign In to add comment