내가 134658과 같은 숫자를 가지고 있고 "6"인 3 자리 (수백 자리)를 원한다고 가정 해 봅시다.값에서 숫자를 가져 오는 가장 짧은 방법
Objective-C에서 가장 짧은 길이의 코드는 무엇입니까?
이 내 현재 코드입니다 :
int theNumber = 204398234;
int theDigitPlace = 3;//hundreds place
int theDigit = (int)floorf((float)((10)*((((float)theNumber)/(pow(10, theDigitPlace)))-(floorf(((float)theNumber)/(pow(10, theDigitPlace)))))));
//Returns "2"
방금 숫자를 얻으려고합니까? – Pavan
@Pavan Nope, 주어진 숫자를 얻으려고합니다. –