Scripts with Input and output:
Placing all this together, we can implement the algorithm from the starting of this section. The following script computes and prints the area of a circle. At first it prompts the user for a radius, reads the radius, and then computes and prints the area of the circle based on this radius.
Executing the script generates the output as shown below:
>> script2
Now enter the radius: 3.9
For the circle with radius of 3.90, the area is 47.78
Note that the output from the first two assignment statements is suppressed by putting the semicolons at the end. That is often completed in scripts; therefore the exact format of what is displayed by the program is controlled by the fprintf functions.