A better way to do this is to take X as input and Y as input both as an int and then apply the math to it and all you would need to print is the result of both of them.
int x = 2;
int y = 1;
int z = x * y;
printf("%i", z);
or if you want you can use ctype.h
library and make a for
loop to go over each letter of the string and assign it on an array if it's a number using the isdigit
function which would return if that one letter is a digit or not and if it is a digit you can assaign it a varible like int z[x] = *string-name*[i]
so it would be like
char *anything = "thi2sst3ringhasnumber5";
int length = strlen(anything);
int x = 0;
for (int i = 0; i < length; i++)
{
if (isdigit(anything[i]))
{
int numbers[x] = anything[i];
x++;
}
}
and that would return to you an array of [2, 3, 5] as numbers[0, 1 ,2]
so if you wanted to take multiply them you can do *something* = numbers[0] * numbers[1];
which is 2 * 3 and you can assign it to a variable and print it out.