// C program to concatenate
// two integers into one

#include <stdio.h>
#include <string.h>
#include <stdlib.h> //imp

// Function to concatenate
// two integers into one
int concat(int a, int b)
{

	char s1[20];
	char s2[20];

	// Convert both the integers to string
	sprintf(s1, "%d", a);//imp
	sprintf(s2, "%d", b);

	// Concatenate both strings
	strcat(s1, s2);

	// Convert the concatenated string
	// to integer
	int c = atoi(s1);//imp

	// return the formed integer
	return c;
}

int main()
{
	int a = 23;
	int b = 43;

	printf("%d\n", concat(a, b));

	return 0;
}

/* This code is contributed by Ayush Singla(@ayusin51)

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

char concat(int *a,int *b){
    char s1[10];
    char s2[10];
    
    sprintf(s1,"%d",*a);
    sprintf(s2,"%d",*b);
    
    strcat(s1,s2);
    
    int c=atoi(s1);
    printf("%d",c);
    *a=5;
    *a=*a+1;
}

int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    concat(&a,&b);
    printf("\n%d %d",a,b);
}
*/

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: