Concatenate two integer variables in C



#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int concatenateInt(int firstNumber, int secondNumber)
{
 int count = 0;
 int temp = secondNumber;
 while (secondNumber)
 {
  secondNumber = secondNumber / 10;
  count++;
 }
 if (count == 0)
  count = 1;
 return (firstNumber * pow(10, count) + temp);
}

No comments :

Post a Comment

Comment Here