Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to convert the numbers in an integer array to integer numbers, for example: int a[3] = {1,3, 2}; converted to int b = 132;
How to convert the numbers in an integer array to integer numbers, for example: int a[3] = {1,3, 2}; converted to int b = 132;

#include

int A[] = {1,2,3};

int fun( int n )

{

int RetVal = 0;

for (int i = 0 ; i < n ; ++i )

{

RetVal = RetVal * 10 + A[ i ];

}

return RetVal;

}

int main ()

{

printf("%d",fun(3));

getchar();

return 0 ;

}