Data is entered from the user by using the scanf() function. The scanf() function reads in integers, floating-point variables, and characters. The format string for the scanf() function is:
The format string includes type-specifiers that instruct scanf() how to interpret key characters. Here are the scanf() type-specifiers, which will be introduced at this time:
/* area.c
*/
#include<stdio.h>
#include<conio.h>
main()
{
double area, length, width;
printf("Enter a length--> ");
scanf("%lf", &length);
printf("Enter a width--> ");
scanf("%lf", &width);
area = length * width;
printf("\n\nThe length is %lf and the
width is %lf.", length, width);
printf("\nThe area is %lf. ", area);
getch();
return 0;
}