Output float with format: round : Formatted Output Float « Console « C / ANSI-C






Output float with format: round


#include <stdio.h>

void main()
{
   float radius = 2.0f;              /* The radius of a table            */
   const float Pi = 3.14159f;        /* Defines the value of Pi as fixed */

   printf("\nThe circumference is %.2f", 2.0f*Pi*radius);
   printf("\nThe area is %.2f", Pi*radius*radius);
}


           
       








Related examples in the same category

1.Outputting floating-point valuesOutputting floating-point values
2.Printf with format
3.Use printf to control the output format
4.More output format with printf