Subroutine and functions, Basic Computer Science

Subroutine and Functions:

 In a program, it is often necessary to repeat a statement or group of statements at several points to accomplish a particular task. Repeating the same statement in a program each time makes a program lengthy and reduces readability. These problems could be sorted out if the necessary statements could be written once and then referred to each time they are needed. This is the purpose of a subprogram. Basically there are two different types of subprograms, called functions and subroutines.  Making subprograms allows tackling small pieces of a problem individually. 

Once each piece is working correctly then the pieces are integrated together to create the complete solution of the problem. To implement functions and subroutines, we require writing the main program that references all of the subprograms in the desired order and also writing the subprograms. This can  be done in any order that is convenient. 

Posted Date: 10/23/2012 3:57:36 AM | Location : United States







Related Discussions:- Subroutine and functions, Assignment Help, Ask Question on Subroutine and functions, Get Answer, Expert's Help, Subroutine and functions Discussions

Write discussion on Subroutine and functions
Your posts are moderated
Related Questions
I need help! import cgi, cgitb cgitb.enable() HTML_head = ''Content-type: text/html\n\n'' HTML_top = '''''' Restaurant Results '' Restaurant Results '''''' HTML_bottom =

WHY ISN''T THE PRICE STORED ON THE BARCODE

A process is a chronological program in execution. The constituents of a process are the following: • The object program to be executed ( described the program text in UNIX) • Th

Device Drivers:   Device drivers are shared computer programs that provide an interface between the hardware devices and operating system or other higher level programs.

QUESTION (a) Compare the adapter pattern with the façade and decorator patterns. (b) Illustrate a two-way adapter pattern. (c) Describe 3 components of a pattern. (d)

In this program, you are going to write a program for playing the game of Hangman. In this game, the computer will pick a word and display a sequence of blanks to be filled in; one

Problem When a data is sent across the network it is encrypted and arranged in a way that even if there is a diversion in the flow of data should not leak the data. At the rece

Example of flowcharting: Example Problem statement: To find out whether a given number is even or odd. Algorithm: Step 1 Start Step 2 INPUT the number n  Step 3

Question 1 What are the important Issues in Search Problem Question 2 What do you mean by Predicates? Briefly explain Question 3 What are the advantages of Wireles

access,excel and ms word/