We have already seen what printf does, scanf is a similar function except that it reads input from the user instead of writing output. The following is a simple example of how the scanf works.
#include <stdio.h>
main (){
float area;
int radius;
const float pie = 3.14;
printf(“Enter the radius of the circle”);
scanf(“%d”, &radius);
area = pie * radius * radius;
printf(“Area is %f\n”, area);
}
No comments:
Post a Comment