I want to write a function that takes a positive integer as input and returns the leading digit in its decimal representation. For example, the leading digit of 234567 is 2
1
Expert's answer
2012-10-10T11:54:58-0400
#include <iostream> using namespace std;
int main (){ int a; cin>>a; while (a>9){ & a /= 10; } cout<<a<<endl; system("pause"); return 0; }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment