
EBK DATA STRUCTURES AND ALGORITHMS IN C
4th Edition
ISBN: 9781285415017
Author: DROZDEK
Publisher: YUZU
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 4, Problem 2PA
Program Plan Intro
Program Plan:
- In “main()” function
- Declare variables “stackk1” for stack, “base_to” for base to which convert and “numm” for number in decimal to be convert.
- Read values for “base_to” and “numm” from user.
- If base is between “2” and “9” and “numm” is greater than “0”,
- Push the value of “numm” mod “base_to” into stack “stackk1”.
- Then Divide “numm” by “base_to” and take this value as next “numm”.
- Continue above two steps till “numm” becomes “0”.
- Pop all numbers from “stackk1” and print it till “stackk1” becomes empty.
- If base is not between “2” and “9”, print error message.
Program Plan Intro
Modified program to convert a decimal number into any base between “11” and “27”:
Program Plan:
- In “main()” function
- Declare variables “stackk1” for stack, “base_to” for base to which convert and “numm” for number in decimal to be convert.
- Read values for “base_to” and “numm” from user.
- If base is between “11” and “27” and “numm” is greater than “0”,
- Push the value of “numm” mod “base_to” into stack “stackk1”.
- Then Divide “numm” by “base_to” and take this value as next “numm”.
- Continue above two steps till “numm” becomes “0”.
- Pop each number “ele” from “stackk1”
- If “ele” is less than or equal to “9”, print itself.
- If “ele” is greater than “9” and less than “27”, print character corresponding to ASCII value of “ele+55”
- If base is not between “11” and “27”, print error message.
Expert Solution & Answer

Want to see the full answer?
Check out a sample textbook solution
Students have asked these similar questions
4. |z + 5 - 5i| = 7
14.
dz,
C: |z❘
C: |z❘ = 0.6
ze² - 2iz
H
14.
dz,
C: |z❘
C: |z❘ = 0.6
ze² - 2iz
H
Chapter 4 Solutions
EBK DATA STRUCTURES AND ALGORITHMS IN C
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Systems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage Learning

C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning

C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage

EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT

Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,

Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning