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
Modify Program 7.4 so the value of triangularNumber is returned by the calculateTriangularNumber() function to the main() function. Then modify the main() function so that it calls the new version of the calculateTriangularNumber() function accordingly to display the results. (Note: Modify the program 7.4 in the similar way that program 7.5 is revised to program 7.6. All the codes are included in the lecture notes.
What is wrong in the following function?
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.
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