Just use the expression
sum = ch1 - '0' + ch2;
and then
printf("sum = %c ", sum);
Here is a demonstrative program
#include <stdio.h>
int main(void)
{
char ch1 , ch2, sum;
ch1 = '2';
ch2 = '6';
sum = ch1 -'0' + ch2;
printf( "sum = %c\n ", sum );
// ^^^
return 0;
}
Its output is
sum = 8
Another approach is the following
#include <stdio.h>
int main(void) {
char ch1 , ch2, sum;
ch1 = '2';
ch2 = '6';
sum = ch1 -'0' + ch2 - '0';
printf( "sum = %d\n ", sum );
// ^^^
return 0;
}
As for your code then in this code snippet
ch1 = '2';
ch2 = '6';
sum = ch1+ch2;
the expression ch1+ch2
is evaluated like 50 + 54
(if there is used the ASCII coding of characters)