Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • DSA
  • Practice Problems
  • Python
  • C
  • C++
  • Java
  • Courses
  • Machine Learning
  • DevOps
  • Web Development
  • System Design
  • Aptitude
  • Projects
Open In App
Next Article:
Arithmetic Operators in Solidity
Next article icon

Arithmetic Operators in LISP

Last Updated : 21 Sep, 2021
Comments
Improve
Suggest changes
Like Article
Like
Report

Arithmetic operators are used to perform mathematical operations like addition, subtraction, multiplication, and division.

There are 7 arithmetic operators in LISP that are listed in the below table:

OperatorSyntaxDescription
Addition Operator(+)+ num1 num2Add the two numbers
Subtraction Operator(-)– num1 num2Subtract the second number from the first number
Multiplication(*)* num1 num2Multiply two numbers
Division(/)/  num1 num2Divide the two numbers
Modulus(mod) mod num1 num2Get the remainder of two numbers
Increment(incf)incf  num valueIncrement number by given value
Decrement(decf)decf num valueDecrement number by given value

Example 1: LISP Program that demonstrates arithmetic operators

Lisp

;set value 1 to 300
; set value 2 to 600
(setq val1 300)
(setq val2 600)
  
;addition operation
(print (+ val1 val2))
  
;subtraction operation
(print (- val1 val2))
  
;multiplication operation
(print (* val1 val2))
  
;division operation
(print (/ val1 val2))
  
;modulus operation
(print (MOD val1 val2))
  
;increment a by 10
(print (incf val1 val2))
  
;decrement b by 20
(print (decf val1 val2))
                      
                       

Output:

900    -300    180000    1/2    300    900    300 

Example 2:

Lisp

;set value 1 to 30
; set value 2 to 15
(setq val1 30)
(setq val2 15)
  
;addition operation
(print (+ val1 val2))
  
;subtraction operation
(print (- val1 val2))
  
;multiplication operation
(print (* val1 val2))
  
;division operation
(print (/ val1 val2))
  
;modulus operation
(print (MOD val1 val2))
  
;increment a by 10
(print (incf val1 val2))
  
;decrement b by 20
(print (decf val1 val2))
                      
                       

Output:

45    15    450    2    0    45    30 


Next Article
Arithmetic Operators in Solidity

M

manojkumarreddymallidi
Improve
Article Tags :
  • LISP
  • LISP-Basics

Similar Reads

  • Bitwise Operators in LISP
    In this article, we will discuss the Bitwise operators in LISP. These operators are used to perform the manipulation of individual bits of a number. The truth table for bitwise AND, NAND, OR, XOR, NOR, & XNOR:  aba and b a nand ba or b a xor b a nor b a xnor b00010011010111001110100110011100 Dif
    4 min read
  • Arithmetic Operations
    Arithmetic Operations are the basic mathematical operations—Addition, Subtraction, Multiplication, and Division—used for calculations. These operations form the foundation of mathematics and are essential in daily life, such as sharing items, calculating bills, solving time and work problems, and in
    10 min read
  • JavaScript Arithmetic Operators
    JavaScript Arithmetic Operators are the operator that operate upon the numerical values and return a numerical value. Addition (+) OperatorThe addition operator takes two numerical operands and gives their numerical sum. It also concatenates two strings or numbers. [GFGTABS] JavaScript // Number + N
    6 min read
  • Arithmetic Operators in Solidity
    Arithmetic operators are used to perform arithmetic or mathematical operations. Solidity has the following types of arithmetic operators: Addition: The addition operator takes two operands and results in a sum of these operands. It is denoted by +.Subtraction: The subtraction operator takes two oper
    2 min read
  • Operators in LISP
    Operators are the foundation of any programming language. Thus the functionality of the LISP programming language is incomplete without the use of operators. We can define operators as symbols that help us to perform specific mathematical and logical computations on operands. In other words, we can
    5 min read
  • Comparison Operators in LISP
    In this article, we will discuss the comparison operators in LISP. These operators are used to compare numbers by taking two or more operands. Note: This will work only on numbers, Different comparison operators are:OperatorSyntaxNameDescription== operand1 operand2equal toThis operator checks if the
    4 min read
  • VBA Arithmetic Operators in Excel
    Arithmetic Operators are the operators which perform mathematical operation or which perform any operation between two numbers like addition(+), subtraction(-), multiplication(*), division( / ), exponentiation(^), modulus(Mod), Bit-Shift operations. In this article, we will learn about the excel VBA
    3 min read
  • Arithmetic Operators in PostgreSQL
    PostgreSQL is an advanced relational database system that supports both relational (SQL) and non-relational (JSON) queries. It is free and open-source. One of the most fundamental properties of database systems is arithmetical operations, without which a multitude of tasks, from simple arithmetic to
    8 min read
  • Arithmetic Operators in SQL Server
    Arithmetic operators play a crucial role in performing mathematical calculations within SQL Server. These operators allow you to perform addition, subtraction, multiplication, division, and more on numeric data stored in your database tables. In this article, we'll explore the various arithmetic ope
    4 min read
  • Bash Script - Arithmetic Operators
    In this article, we will see arithmetic operators in bash script. Arithmetic operators is used to perform arithmetic operations. Bash script supports 11 arithmetic operators. All the operators with their uses is given below: OperatorNameUseExample+AdditionIt adds two operandsresult= a+b-SubtractionI
    3 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences