Integer number upside down and find daffodils

 

 

#include <stdio.h> 
#include <stdlib.h> 
void numReverse (NUM int); 
void numReverseWithoutArr (NUM int); 
void main () { 
	numReverse (123459); 
	getchar (); 
} 
void shuiXian () { 
	// numbers by daffodils (3 digits, the digits of which is equal to the number of cubic and itself) 
	int NUM, F, S, T; 
	for (NUM = 100; NUM <= 999; NUM ++) { 
		F NUM = 10%; 
		NUM = 10% S / 10; 
		T = S / 100; 
		IF (NUM == F * F * F * S * S + S + T * T * T) { 
			the printf ( "% D,% D, D%, % D \ n-", NUM, F, S, T); 
		} 
	} 
} 
int get10 (int n-) {// Get the number n * 10 is 
	int RES =. 1; 
	for (int I = 0; I <n-; I ++ ) { 
		RES * = 10; 
	} 
	return RES; 
}
void numReverse (int num) {// integer inverted temporary data array str 
	int str [10]; 
	int I = 0; 
	int length; // change the length of the array 
	int RES = 0; 
	int J = 0; 

	for (; NUM; I ++) { 
		STR [I] = NUM% 10; 
		NUM / = 10; 
		
	} 
	length = I; 
	
	the while (J <length) { 
		RES + = STR [J] * get10 (length-J-. 1); 
		++ J; 
	} 
	the printf ( "% D", RES); 
} 

void numReverseWithoutArr (int NUM) {// integer inverted temporary data array without str 
	// 123 
	int RES = 0; 
	for (int I = 0; NUM; I ++ ) { 
		RES NUM = get10 * 10% (. 1-I); 
		NUM / = 10; 
	} 
	the printf ( "% D", RES); 
}

 

Guess you like

Origin www.cnblogs.com/luoxuw/p/11258468.html