Using printf() to output the correct number of decimal places
07:50 04 May 2022

When I enter 2, I wish to get this output:

value: 2.4

But when I do the multiplication, I am getting this:

value: 2.400000

This is my code:

#include 

int main()
{
  float num;
  float result;
  
  printf("Number: ");
  scanf("%f", &num);
  
  result = num * 1.2;
  printf("Result: %f", result);
}

What can I do?

c floating-point formatting printf stdout