answersLogoWhite

0


Best Answer

echo -n "Enter the radius of a circle : "

read r

# use formula to get it

area=$(echo "scale=2;3.14 * ($r * $r)" | bc)

# use formula to get it

d=$(echo "scale=2;2 * $r"|bc)

circumference=$(echo "scale=2;3.14 * $d"| bc)

echo "Area of circle is $area"

echo "Circumference of circle is $circumference"

# ### softspy88@gmail.com

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a shell program to find the area and circumference of the circle?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a Shell program to find the area and circumference of a circle?

echo "Enter the Number" read n r=`expr $n % 2` if [ $r -eq 0 ] then echo "$n is Even number" else echo "$n is Odd number" fi


Shell program for gcd of three given numbers?

write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? write a shell program for finding out gcd of three given numbers? check bellow link http://bashscript.blogspot.com/2009/08/gcd-of-more-than-two-numbers.html


Shell script to find area of a circle?

To write a shell script to find the area of a circle, you can use the formula: area = π * radius^2. Here is an example shell script using the read command to input the radius from the user: #!/bin/bash echo "Enter the radius of the circle:" read radius area=$(echo "3.14159 * $radius * $radius" | bc) echo "The area of the circle with radius $radius is $area" This script first prompts the user to enter the radius, calculates the area using the formula, and then displays the result.


Write a Shell program to find the smallest number from a set of numbers?

k


Write a shell program to check and display 10 leap years?

dono


Write a Shell program to find the sum of cube of individual digits of a number?

no thanks


Write a shell program to delete all the files in the current directory?

in winxp del *.* /Q /S


Write a program in shell script to display odd number from 0 to 100?

seq 1 2 99


Write a shell program called whos to display a sorted list of the logged in usersJust display the user names and no other information?

The 'users' command should do that; you don't need to write a shell script to get that information in that format.


Write a shell program using if-the-else to test whether a variable name is a directory or a file?

see : Write_a_shell_program_using_the_if-the-else_to_test_whether_a_variable_name_is_a_directory_or_a_file


Write a shell program to translate the6 etcpasswd file into uppercase?

tr [:lower:] [:upper:] < /etc/passwd > somefile


When might it be necessary or advisable to write a shell script instead of a shell function?

A shell function will do nothing unless it is explicitly called by other code, typically in a shell script. A shell script is a runnable, executable process, which can call other shell scripts and/or functions. The question might be worded backwards - it is necessary to write shell functions for shell scripts when certain logical functionality is required to be performed multiple times. Consider a shell function equivalent to a program subroutine - they operate the same way.