变量与输入

2016-10-11 19:54:34来源:CSDN作者:g13731463274人点击

[root@mysql1 perl]# ./10.pl 
what is the radius? 0
the circumference of a circle of radius 0 is 0.
[root@mysql1 perl]# ./10.pl 
what is the radius? 1
the circumference of a circle of radius 1 is 6.283185308.
[root@mysql1 perl]# ./10.pl 
what is the radius? 2
the circumference of a circle of radius 2 is 12.566370616.
[root@mysql1 perl]# 
[root@mysql1 perl]# 
[root@mysql1 perl]# 
[root@mysql1 perl]# cat 10.pl 
#!/usr/bin/perl -w


$pi=3.141592654;
print "what is the radius? ";
chomp($radius=<STDIN>);
$circ=2 * $pi * $radius;
print "the circumference of a circle of radius $radius is $circ./n";

最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台