find last digit of number code example
Example 1: code to find the last digit of a number
int n;
cout<<"Enter the number";
cin>>n;
int LD= n % 10;
cout<<LD<<endl;
Example 2: find last digit of number
//C++
int last_digit = number % 10;
int n;
cout<<"Enter the number";
cin>>n;
int LD= n % 10;
cout<<LD<<endl;
//C++
int last_digit = number % 10;