Lesson 38: Applying functions
NOTE: for a fast copy, follow these steps in order:
- Click anywhere in the text box below (result will be a blinking vertical line in the text box
- Hit ctrl + A on the key board (the "ctrl + A" means hit Ctrl and A at the same time)
(The result should be that all the text inside the text box lights up in blue)
- Hit Ctrl + C (Nothing significantly happens that is visible) and now its copied to the clipboard and your ready to paste it anywhere you wish
This is an example of a prime number algorithm that is being used inside the main loop..
Prime function |
OTE: You will have to scroll all the way down on the text boxes to see the main body
NOTE: There is a more efficint version of the prime algorithm in one of the ctime library videos
Here are some examples that use the Prime function. (You will have to scroll to see the main body of the program)
This code will print the first 100 prime numbers to the screen
This next two pieces of code are examples of how to print NON-prime numbers to the screen
Here is an application of the NOT (!) operator
Here is an example of a void function. void functions does NOT take a return type... thats the only difference
Here is an example of using a void type function