I've been trying to to display decimal points to 2 decimal places for a multiplication operation:
if (operation == multiplication)
{
printf("\n\n You have chosen to perform a multiplication operation\n\n");
printf("Please enter two numbers seperated by a space (num1 * num2): ");
scanf("%f %f", &number1, &number2);
total = number1 * number2;
printf("\n%f times %f is equal to: %f", number1, number2, total);
}
so if I enter 0.5 & 30 I'll get 15 and not 15.000000 and if I enter 0.5 & 15 I'll get 7.50 and not 7.5000000.
I'm still quite new to programming in C and in general as well, so detailed explanations would really be great. Thanks.