bash-3.2$ cat math.ksh
#!/bin/ksh
# Script name: math.ksh
# This script finds the cube of a number, and the
# quotient and remainder of the number divided by 4.
y=99
(( cube = y * y * y ))
(( quotient = y / 4 ))
(( rmdr = y % 4 ))
print “The cube of $y is $cube.”
print “The quotient of $y divided by 4 is $quotient.”
print “The remainder of $y divided by 4 is $rmdr.”
# Notice the use of parenthesis to
# control the order of evaluating.
(( z = 2 * (quotient * 4 + rmdr) ))
print “Two times $y is $z.”
——
bash-3.2$ ./math.ksh
The cube of 99 is 970299.
The quotient of 99 divided by 4 is 24.
The remainder of 99 divided by 4 is 3.
Two times 99 is 198.
From: http://sitestree.com/?p=12236
Categories:Linux/Unix: Shell Programming – 001
Tags:
Post Data:2018-05-08 23:37:30
Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada