Program file for Linux calculator Calculation

Source: Internet
Author: User
Tags bcbc

Do you know what a Linux calculator is? This very advanced application technology will be explained by me very much. Where is the Linux calculator NB? Next I will introduce the unlimited field of the Linux calculator.

19 -- bc Linux Calculator

[Root @ CentOS4 ~] # Bcbc 1.06 Copyright 1991-1994,199 7, 1998,200 0 Free Software Foundation, Inc. this is free software with absolutely no warranty. for details type 'warranty '. (interrupt) use quit to exit. (interrupt) use quit to exit. quit [root @ CentOS4 ~] # Common operators for Linux calculators on bc include: + addition-subtraction * multiplication/division, which is automatically rounded when scale precision is not set) ^ exponent % evaluate the modulus of remainder) you can also use the ++ variable -- variable ++ variable --

[Root @ CentOS4 ~] # Bcbc 1.06 Copyright 1991-1994,199 7, 1998,200 0 Free Software Foundation, Inc. this is free software with absolutely no warranty. for details type 'warranty '. 1 + 23234 + 23/2*326725 ^ 315625100% 40100% quit [root @ CentOS4 ~] # [Root @ CentOS4 ~] # Bc 1.06 Copyright 1991-1994,199 7, 1998,200 0 Free Software Foundation, Inc. this is free software with absolutely no warranty. for details type 'warranty '. scale = 2/* scale = number */11/42 .7511/33.66 quit [root @ CentOS4 ~] #
Linux calculator Description: scale = 2 sets the decimal precision. /* Remarks */

Bc can also run a program file with complex operations on a Linux calculator. This is an extended attribute of bc. For example: the following is code that uses the extended features of bc to implement a simpleprogram for calculating checkbook balances. this program is best kept in a file so that it can be used when times withouthaving to retype it at every use.

Linux calculator uses vi to create a test program: root @ CentOS4 ~] # Vi testscale = 2 print "" nCheck book program! "N" print "Remember, deposits are negative transaction." n "print" Initial balance? "; Bal = read () bal/= 1 print" "n" while (1) {"current balance ="; bal "transaction? "; Trans = read () if (trans = 0) break; bal-= trans bal/= 1}

"Test" [New] 14L, 268C written [root @ CentOS4 ~] # Ls Calculation Result: [root @ CentOS4 ~] # Bc "testbc 1.06 Copyright 1991-1994,199 7, 1998,200 0 Free Software Foundation, Inc. This is free software with absolutely no warranty. For details type 'warranty '. Check book program! Remember, deposits are negative transaction. Initial balance? 560 current balance = 560.00 transaction? 400 current balance = 160.00 transaction? 100 current balance = 60.00 transaction? 0 quit [root @ CentOS4 ~] #

I learned this in the Linux calculator today and found a lot of interesting content. According to recent studies, to learn Linux calculators well, it is important to learn English well. Although the general meaning can be clearly understood, it is very difficult to find out the meaning of a word, which often wastes a lot of time to solve the meaning of the word.

  1. Linux Oracle can be installed on WMware virtual machines
  2. Create a private key and an SSH configuration file in CentOS Linux
  3. Some Efficient Linux Command Line operations
  4. Backdoor technology and Linux LKM Rootkit
  5. Install Memcache in Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.