Programming in C
Programming in C
4th Edition
ISBN: 9780321776419
Author: Stephen G. Kochan
Publisher: Addison-Wesley
Question
Book Icon
Chapter 7, Problem 2E
Program Plan Intro

Program Plan:

  • Include required header files
  • Give the function prototype
  • Define the main function
    • Declare the variable “number” and “counter” as “int”.
    • For loop to increment the value of counter.
      • Get the number from the user.
      • Call the function “calculateTriangularNumber ()”.
      • Return the value “0”.
  • Definition for the function “calculateTriangularNumber()”
    • Declare the variable “i” , “t” as “int”.
      • For loop to check the condition.
        • Add the value of “i” and store it in the variable “t”.
        • Return the value of “t”.

Blurred answer
Students have asked these similar questions
Change this question to work using a function. decide what the name of the function of each should be, how many parameters are required and what value needs to be returned. You're no longer required to solve the problem - try to re-manage your code to be a function. Write a program that gets 2 string variables and 2 integer variables from the user, concatenates (joins them together with no space) and displays the strings, then multiplies the two numbers on a new line and displays them with two decimal points. n1 = int (input ("Enter a number:")) n2 = int (input ("Enter another number:")) s1 = input ("Enter a string") s2 = input ("Enter another string") print ("Concatenated string: %s, multiplied number %.2f"%(s1+s2, n1*n2))
Write a program with two functions and a main(), each having at least two parameters. The functions need to at least be able to pass information between each other. Each function must return values as well. Write your code, test your code, and draw illustrations to show how information passes between the functions.
Change this question to work using a function. decide what the name of the function of each should be, how many parameters are required and what value needs to be returned. You're no longer required to solve the problem - try to re-manage your code to be a function. Write a program that uses input to prompt a user for their name and then welcomes them. Enter your name: Chuck Hello Chuck
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education