
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
thumb_up100%
Take user input of two integers a and b, add both the numbers and print the result in output but add both the numbers without using addition operator. Use C++ language.
Expert Solution

arrow_forward
Algorithm -
We are given two integers a,b and we have to add them without using addition operator, we can do this using increment (++) operator.
a + b = a + 1*b = a + (1+1+1 + ...... b times)
So, run a loop for b iterations and increment the value of a inside the loop.
Step by stepSolved in 3 steps with 1 images

Knowledge Booster
Similar questions
- Write a Program in C++ to read 10 integers from user and find the maximum value of all these 10 numbers. Print the maximum value in output.arrow_forwardUse C++arrow_forwardI know in C++ we use float, double or long double to hold different bytes of the real numbers. However, I am confused about when to use which one. Please give me some examples also. I also confused to know the bytes of the real numbers.arrow_forward
- With the aid of c++, write a program which utilizes a random number generator to bring out(generate) a 2 digits +(positive) integer and permits the user to do 1 or more of the operations listed below.Find i.Sum of the digits of the number ii.double of the number In case the random number generated is less than 10,add ten to the number. N.b The 'number' word used above represents the randomly generated 2 digits +(positive) integer.arrow_forwardWith the aid of c++, write a code which utitilizes a random number generator to generate a 2 digits +(positive) integer. The user is permitted to do the operations listed below using the above knowledge. i.Raise the 1st digit of the randomly generated number to the exponent of the 2nd digit. ii.check if the randomly generated number is a prime numberarrow_forwardGiven an integer n, read input n characters from user and then print them in sorted order. Also read the value of n from user. Language- C++arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education