Float data type outputs the data with 6 decimal points(like 5.00000) even the number doesn't have any decimal points.Why is that so?Can it just output the necessary decimals?
Code:
#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
float a,b,c,x;
printf("Use this to work out the length of the hypotenuse on a right angled triangle.\n");
printf("Please enter a:");
scanf("%f",&a);
printf("\nPlease enter b:");
scanf("%f",&b);
// a*a+b*b=c*c;
x=a*a+b*b;
c=sqrt(x);
printf("\nThe triangle's hypotenuse has a length of %f ",c);
getch();
return 0;
}