Answers for "int get last digit"

1

Find first and last digit of int

#include <iostream>
using namespace std;

int main()
{
    int number;
    cout << "Enter a number : " << endl;
    cin >> number;

    cout << "Last digit is : " << number % 10 << endl;

    while(number >= 10){
        number = number/10;
    }

    cout<< "First digit is : "<< number << endl;
    return 0;
}
Posted by: Guest on April-03-2022
0

how to find last digit in number by regex in java

(\d+)(?!.*\d)
Posted by: Guest on November-10-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language