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
Write a C++ program that declares three integers and three strings. The program prompts the user for three characters and three integers and prints them all on one line.

disvange and advantege of providing intternet sservice to customer

Reflex agent-Artificial Intelligence If an agent decides and executes an action in response to a sensor input without consultation of its world, then it may be considered a ref

Heuristic Search Strategies-Artificial intelligence In general speaking, a heuristic search is one which utilizes a rule of thumb to improve an agent's performance in solving p

THE MICROPROCESSOR The three fundamental units, which comprise a CPU, have now been discussed in general terms.  So too has a microprocessor, because a microprocessor can be de

StatefulServer, maintains some information between requests. Requires smaller messages, since some information is kept between contacts, example: FTP, telnet. Stateless Server req

Impact Printers and non - Impact Printers: Impact Printers: These are printers in which the print-head strikes a ribbon, and include the daisywheel and thimble printer

Accessing Folders and Printers Accessing folders, files and printers of another computer is as easy as accessing another computer. To access folders and printers of another c

In many respect threads operate in the similar way as that of processes. A number of the similarity and differences are: Similarities • Similar to processes threads share CPU and o

Compact Diskette (CD) CD-ROM CD-ROM stands for Compact Disk-Read Only Memory. This disk comes with data already stored in it. It can store around 640 MB of