Sat Jan 04 2025 05:32:57 GMT+0000 (Coordinated Universal Time)
Saved by @KKOMAL
#include <iostream> using namespace std; int main() { int a; cout << "enter a number: "; cin >> a; cout << "Last digit: " << a%10; for (a; a >= 10; a /= 10) { } cout << "\nFirst digit: " << a; return 0; }
Copy this HTML code:
Preview:
open_in_newInstructions on embedding in Medium
Comments