The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > 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 08-07-2008 11:21 AM
Multiplication Station 0.5.2 (Default branch) iBot Software Releases - RSS News 0 05-17-2008 07:40 AM
Multiplication Station 0.5.0 (Default branch) iBot Software Releases - RSS News 0 02-11-2008 01:20 PM
Simple multiplication problem greekozz UNIX for Dummies Questions & Answers 8 07-06-2007 09:32 AM
How to display fractions of a second in UNIX GNMIKE Shell Programming and Scripting 2 07-31-2005 12:19 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-07-2008
alby alby is offline
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.
  #2 (permalink)  
Old 07-07-2008
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
modérateur
  
 

Join Date: Dec 2007
Location: Home of 17-time world champion Boston Celtics
Posts: 1,311
Wink one solution...

Code:
> myv=50000
> myp=.20
> echo "$myv"*"$myp" | bc
10000.00
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 03:01 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0