The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > Linux
Google UNIX.COM


Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
multiplication shows syntax error sonicstage UNIX for Dummies Questions & Answers 4 1 Week Ago 08:21 AM
Multiplication Station 0.5.2 (Default branch) iBot Software Releases - RSS News 0 05-17-2008 04:40 AM
Multiplication Station 0.5.0 (Default branch) iBot Software Releases - RSS News 0 02-11-2008 09:20 AM
Simple multiplication problem greekozz UNIX for Dummies Questions & Answers 8 07-06-2007 06:32 AM
How to display fractions of a second in UNIX GNMIKE Shell Programming and Scripting 2 07-31-2005 09:19 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-07-2008
Registered User
 

Join Date: Jun 2008
Posts: 3
Multiplication with Fractions

Hello there,
how do i multiply a fraction and a whole number? Example 20% of 50,000.
I had gotten 0.2 using the following:

chk=echo 20 100 | awk `{print $1/$2}`
echo $chk

$chk \* 50000 displays the error: non-numeric expression.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 07-07-2008
joeyg's Avatar
premier etoile de match
 

Join Date: Dec 2007
Location: Home of world champion Boston Celtics
Posts: 511
Wink one solution...

Code:
> myv=50000
> myp=.20
> echo "$myv"*"$myp" | bc
10000.00
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:24 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0