#include<stdio.h>
#include<conio.h>
main()
{
float AREA,B,H;
clrscr();
printf("Enter Base & Height: ");
scanf("%f%f",&B,&H);
AREA=0.5*B*H;
printf("Area of the given is : %6.2f",AREA);
getch();
}
#include<stdio.h>
#include<conio.h>
main()
{
float AREA,B,H;
clrscr();
printf("Enter Base & Height: ");
scanf("%f%f",&B,&H);
AREA=0.5*B*H;
printf("Area of the given is : %6.2f",AREA);
getch();
}
y we took %6.2f
its for precision formatting 🙂
can you please let me know more about using %6.2f,
i’m beginner so let me know what is precision formatting means.
This is for formatting your number. For e.g. if number is 234.47746 it will be formatted as 234.48. That will show numbers up to second digit post decimal point. I hope this helps you. Enjoy 🙂
thank you very much.its helpful.
What is getch() used for?
It is used for receiving character input from user. Here it used with purpose that during execution we get to see the console screen till the time we don’t enter anything from keyboard.
getch() is used to hold the value