Programming in C
Programming in C
4th Edition
ISBN: 9780321776419
Author: Stephen G. Kochan
Publisher: Addison-Wesley
bartleby

Concept explainers

Question
Book Icon
Chapter 7, Problem 15E
Program Plan Intro

Program Plan:

  • Include required header files.
  • Declare the variable “convertNumber” as “int”.
  • Declare the variable “numberToConvert” as “long int”.
  • Declare the variable “base” as “int”.
  • Declare the variable “digit” as “int”.
  • Definition for the function "getNumberAndBase()”
    • Do until condition fails.
      • Get the number from the user.
      • Get the base from the user.
      • Check whether the base is between 2 and 16.
        • Assign base to “10”.
      • While loop to check whether the “base” is greater than “0”.
  • Definition for the function “convertNumber()”
    • Do until condition fails.
      • Calculate the value.
      • Divide the number by base.
      • Check whether the “numberToConvert” not equals to “0”
  • Definition for the function “dispalyConvertedNumber()”.
    • Declare and assign values for “baseDigits”.
      • Declare the variable “nextDigit” as “int”.
      • Print the statement.
        • For loop to iterate the “digit”.
          • Assign the converted number to “nextDigit”.
          • Print the value of “nextDigit”.
        • Print new line.
  • Definition for main function
    • Call the function “getNumberAndBase()”.
    • Call the function “convertNumber()”.
    • Call the function “displayConvertNumber()”.
    • Return the value “0”.

Blurred answer
Students have asked these similar questions
Just need some assistance with number 3 please, in C#
How do we find the possible  final values of variable x in the following program.   Int x=0; sem  s1=1, s2 =0;   CO P(s2); P(s1); x=x*2; V(s1); // P(s1); x=x*x; V(s1); // P(s1); x=x+3; V(s2); V(s1); Oc
Lab 07: Java Graphics (Bonus lab) In this lab, we'll be practicing what we learned about GUIs, and Mouse events. You will need to implement the following: ➤ A GUI with a drawing panel. We can click in this panel, and you will capture those clicks as a Point (see java.awt.Point) in a PointCollection class (you need to build this). о The points need to be represented by circles. Below the drawing panel, you will need 5 buttons: о An input button to register your mouse to the drawing panel. ○ о о A show button to paint the points in your collection on the drawing panel. A button to shift all the points to the left by 50 pixels. The x position of the points is not allowed to go below zero. Another button to shift all the points to the right 50 pixels. The x position of the points cannot go further than the You can implement this GUI in any way you choose. I suggest using the BorderLayout for a panel containing the buttons, and a GridLayout to hold the drawing panel and button panels.…
Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT