Bootstrap

求逆序数(C语言)

int reverse(int s){
	int sum=0;
	while(s!=0){
		sum*=10;
		sum+=(s%10);
		s/=10;
	}
	return sum;
}
int main(){
	int s,x;
	scanf("%d",&s); 
	while(s!=-1){
		printf("%d\r\n",reverse(s));
		scanf("%d",&s);
	}
}

;