|
|
|
|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||
|
Problem in division
hi
I am having two variables namely a=7 & b=8. I have to subtract these two variables. I am using the command c=`expr $a / $b` When I check the value of c, it comes out to be zero. Please help. Regards Rochit |
| Sponsored Links | ||
|
|
|
|||
|
According to the MAN page: Code:
expr { \*, /, %} expr
Multiplication, division, or remainder of the
integer-valued arguments.what would you expect? Your answer will be zero. To get the remainder use the percent sign. You can use awk: Code:
nawk 'BEGIN {print 7/8}' |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Floating Division in Linux | Dastard | Shell Programming and Scripting | 3 | 04-16-2008 01:57 PM |
| Round with division command | vanloonmichel | Shell Programming and Scripting | 13 | 02-15-2007 09:32 AM |
| division in shell scripts | esham | Shell Programming and Scripting | 6 | 11-30-2005 06:42 AM |
| Cannot adjust division | jav_v | Filesystems, Disks and Memory | 1 | 08-20-2002 09:50 AM |
| division problem | inquirer | Shell Programming and Scripting | 3 | 04-02-2002 11:03 PM |