Computer Science: A Structured Programming Approach Using C, Third Edition
Computer Science: A Structured Programming Approach Using C, Third Edition
3rd Edition
ISBN: 9780534491321
Author: Behrouz A. Forouzan, Richard F. Gilberg
Publisher: Course Technology, Inc.
bartleby

Videos

Question
Book Icon
Chapter 4, Problem 33PS
Program Plan Intro

To write the code that provides an opportunity to the user to enter the measurement in inches and convert it into centimetres.

Program Plan:

Write a program in C that contains a user-defined function, which is used to convert the measurement entered by the user in inches to centimetres.

Following are the steps that used to implement the program.

Define a user-defined function named InchestoCentimeters.

In the main method, declare a variable for reading the value entered by the user.

Make a call to the user-defined method by passing the value as an argument.

Multiply the value entered by the user by 2.54 to convert it into centimetres.

Show the result as the output.

Blurred answer
Students have asked these similar questions
Write a program that asks the user to input two numbers. If the first number entered is greater than the second number, the program should print the message: "The first number is greater." Otherwise, it should print the message:              "The first number is smaller."           By using functions
Write a program that asks the user to input a grade that he or she received on an exam. The grade is an integer between 0 and 100 inclusive. The program should convert the numeric grade into the equivalent letter grade. Do the conversion by using a function Letter_Grade () that converts a numeric grade in the range 0 to 100 to the equivalent letter grade. The function should have one argument, the integer grade. The return value of the function should be A if the grade is 90 to 100; B if the grade is 80 to 89; C if the grade is 70 to 79; D if the grade is 65 to 69; and F if the grade is 64 or lower. After converting the grade, the program should display the nu¬meric grade and the equivalent letter grade.
Write a function number_of_pennies() that returns the total number of pennies given a number of dollars and (optionally) a number of pennies.input: 5 6 4 Output: 506 400 My Code: def number_of_pennies(dollars=0, pennies=0):   numer_of_pennies = (dollars * 100) + pennies   return number_of_pennies print(number_of_pennies(int(input()), int(input()))) # Both dollars and penniesprint(number_of_pennies(int(input()))) # Dollars only However, this is the output that I am getting: <function number_of_pennies at 0x7f6a5e1d7e50> <function number_of_pennies at 0x7f6a5e1d7e50>

Chapter 4 Solutions

Computer Science: A Structured Programming Approach Using C, Third Edition

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
Computer Programming for Beginners | Functions, Parameters & Arguments | Ep24; Author: Programming With Avelx;https://www.youtube.com/watch?v=VXlh-qJpfw0;License: Standard YouTube License, CC-BY