I'm trying to learn by doing. I have written some code below and it's not outputting the way I expected it to. Once I get this piece working I'd like to add code to round the numbers so that there are only 2 to 3 decimal places.

the step after that would be to add code so that I can leave z as an int type and then change it's type in function div()

if you could help out I'd really appreciate it, also if you have any suggestions or areas where I could potentially be shooting myself in the foot I'd appreciate the feedback as well


my code looks like this:

Code:
#include <stdio.h>

int x,y;
float z,a;

int mult(int x,int y);
float div(int x,int y);

int main()
{
	printf("\nPlease enter a number: ");
	scanf("%d",&x);
	printf("\nPlease enter a second number: ");
	scanf("%d",&y);
	
	a=mult(x,y);
	printf("\n%d times %d equals %f",x,y,a);

	printf("\nand");
	
	a=div(x,y);
	printf("\n%d divided by %d equals %f",x,y,a);
	
	printf("\nHave a nice Day!!!\n");
	
	
	
	
	
	return 0;
}



int mult(int x,int y)
{
	z=x*y;
	return z;
}

float div(int x,int y)
{
	z=x/y;
	return z;
}
and the output looks like this

Code:
Please enter a number: 5

Please enter a second number: 4

5 times 4 equals 20.000000
and
5 divided by 4 equals 1.000000
Have a nice Day!!!
I'm trying to allow variables 5 and 4 to be integers and z and a to be float. I expect the output to look like this

Code:
Please enter a number: 5

Please enter a second number: 4

5 times 4 equals 20.000000
and
5 divided by 4 equals 1.250000
Have a nice Day!!!