{"id":8846,"date":"2023-09-23T19:07:30","date_gmt":"2023-09-23T17:07:30","guid":{"rendered":"https:\/\/blue.pri.ee\/ttu\/?p=8846"},"modified":"2026-06-19T10:57:32","modified_gmt":"2026-06-19T08:57:32","slug":"pr1en4-functions","status":"publish","type":"post","link":"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/","title":{"rendered":"PR1EN4: Functions"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/#Lab_material\" >Lab material<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/#Lab_tasks\" >Lab tasks<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/#Task_1_W04-1_Electricity_price_calculator\" >Task 1 [W04-1]: Electricity price calculator<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/#Requirements\" >Requirements<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/#Recommendations_and_hints\" >Recommendations and hints<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/#Testing\" >Testing<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/#Task_2_W04-2_Sequence_generator\" >Task 2 [W04-2]: Sequence generator<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/#Requirements-2\" >Requirements<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/#Step-by-step_guide\" >Step-by-step guide<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/#Testing-2\" >Testing<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/#Task_3_W04-3_Appointment_planner\" >Task 3 [W04-3]: Appointment planner<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/#Requirements-3\" >Requirements<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/#Time_calculation_algorithm\" >Time calculation algorithm<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/#Approach\" >Approach<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/#Testing-3\" >Testing<\/a><\/li><\/ul><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/#Extra_tasks\" >Extra tasks<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/#Extra_task_1_W04-4_Prime_numbers_and_results_per_line\" >Extra task 1 [W04-4]: Prime numbers and results per line<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/#Requirements-4\" >Requirements<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/#Testing_for_prime_function\" >Testing for prime function<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/#Extra_task_2_W04-5_Add_breaks_and_end-of-day\" >Extra task 2 [W04-5]: Add breaks and end-of-day.<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-21\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/#Requirements-5\" >Requirements<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-22\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/#Testing-4\" >Testing<\/a><\/li><\/ul><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-23\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/#After_this_class_you_should\" >After this class, you should<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-24\" href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/#Additional_content\" >Additional content<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Lab_material\"><\/span><strong>Lab material<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li>Additional topic: <a href=\"https:\/\/blue.pri.ee\/ttu\/coding-guides\/some-printf-tips\/#Padding_and_aligning\"><strong>Padding and alignment<\/strong><\/a><\/li>\n<li>Slides:\u00a0<a href=\"https:\/\/blue.pri.ee\/ttu\/files\/iax0583\/slaidid-en\/04_Functions.pdf\"><strong>Functions<\/strong><\/a><\/li>\n<li>Lab demo codes zipped: <strong><a href=\"https:\/\/blue.pri.ee\/ttu\/files\/iax0583\/programmikood\/wk4_samples.zip\">https:\/\/blue.pri.ee\/ttu\/files\/iax0583\/programmikood\/wk4_samples.zip<\/a><\/strong><\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Lab_tasks\"><\/span>Lab tasks<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>In this lab, you have a total of three lab tasks. All tasks have starter codes that will set the structure of the final solution and give you a planned workflow, which mostly is given as step-by-step instructions.<\/p>\n<p>Tasks number 2 and 3 can be expanded by extra tasks.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Task_1_W04-1_Electricity_price_calculator\"><\/span>Task 1 [W04-1]: Electricity price calculator<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>In this task, we have written most of the program already. This includes the entirety of <span class=\"lang:default highlight:0 decode:true crayon-inline \">main()<\/span>\u00a0 function.<\/p>\n<p>You will need to fill in the missing parts in the functions to complete this program. In the starter code, all of the return values from the functions have been written as <span class=\"lang:default highlight:0 decode:true crayon-inline \">return 0<\/span> . This is done so that the program would compile and you could test it after completing of any function. You need to replace this in every function based on the description in the function comment, right above the function itself.<\/p>\n<p><strong>Download the starter code from here: <a href=\"https:\/\/blue.pri.ee\/ttu\/files\/iax0583\/aluskoodid\/4_1_electricity_template.c\">https:\/\/blue.pri.ee\/ttu\/files\/iax0583\/aluskoodid\/4_1_electricity_template.c<\/a><\/strong><\/p>\n<h4><span class=\"ez-toc-section\" id=\"Requirements\"><\/span>Requirements<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li>Start by introducing yourself to the base code. Your task must be built on it.<\/li>\n<li>Your task is to write the declarative part of every function. The purpose of every function is described right before it as a comment. The comments must remain in the code.<\/li>\n<li><span class=\"lang:default highlight:0 decode:true crayon-inline\">main()<\/span>\u00a0 function and the structure of the code cannot be changed. It&#8217;s recommended to also avoid renaming the functions and variables.<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"Recommendations_and_hints\"><\/span>Recommendations and hints<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li>Start by going through the code. Look at where all the parts of the code are &#8211; libraries, macros, prototypes, main function and the rest of the user-defined functions. Check out how main calls the user-defined functions, what is given as parameters etc. Do not change anything right now!<\/li>\n<li>Once familiar, start by writing the function bodies (declarative part of the function).\u00a0<strong>Solve 1 function at a time, compile and test if it works!<\/strong> <span style=\"color: #ff0000;\"><strong>Do not move forward before it works!<\/strong><\/span><\/li>\n<li>The recommended structure for the input functions is a do while loop, which has an if statement inside to print an error for wrong input.<\/li>\n<li>All other functions are solvable by just writing one line. You need to replace the\u00a0 <span class=\"lang:default highlight:0 decode:true crayon-inline\">return 0<\/span>\u00a0 with the correct formula.<\/li>\n<li>Careful with units! There is a mix of megawatt-hours, kilowatt-hours and watt-hours! Check the function comment for which it is.<\/li>\n<li>VAT &#8211;\u00a0<em>value added tax<\/em>, 24% in Estonia<\/li>\n<li>Current market price in MWh before taxes:\u00a0 <strong><a href=\"https:\/\/dashboard.elering.ee\/et\">https:\/\/dashboard.elering.ee\/et<\/a><\/strong><\/li>\n<li>Current market price per kWh in cents, including taxes:\u00a0 <strong><a href=\"https:\/\/www.elektrikell.ee\">https:\/\/www.elektrikell.ee<\/a><\/strong><\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"Testing\"><\/span>Testing<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><strong>Test 1: no errors<\/strong><\/p>\n<pre class=\"theme:cisco-router toolbar:2 nums:false lang:default highlight:0 decode:true\">Enter the market price for electricity in MWh: 412.65\r\n \r\nMarket cost of electricity is 412.65 EUR \/ MWh.\r\nThis is 0.4126 EUR per kWh before taxes.\r\nThe government takes 0.0990 EUR in taxes.\r\nWith taxes, the cost for you is 0.5117 EUR \/ kWh\r\n \r\nLets do a rough savings estimate when switching from incandescent bulbs to LEDs\r\n \r\nNumber of E27 lightbulbs in use: 9\r\nAverage hours per day the bulbs are turned on for: 6\r\n \r\nResults are calculated for a 30-day month.\r\n \r\nUsing 60 W incandescent bulbs consumes 97200 W, costing 49.74 EUR\r\nUsing 9 W LED bulbs consumes 14580 W, costing 7.46 EUR\r\nThat's a saving of 42.28 EUR.\r\nAt the price of 0.69, you could buy 61 instant noodles with that money!<\/pre>\n<p><strong>Test 2: invalid input tests<\/strong><\/p>\n<pre class=\"theme:cisco-router toolbar:2 nums:false lang:default highlight:0 decode:true\">Enter the market price for electricity in MWh: -5\r\nRetry! Must be &gt; 0\r\n&gt; 125\r\n\r\nMarket cost of electricity is 125.00 EUR \/ MWh.\r\nThis is 0.1250 EUR per kWh before taxes.\r\nThe government takes 0.0300 EUR in taxes.\r\nWith taxes, the cost for you is 0.1550 EUR \/ kWh\r\n\r\nLets do a rough savings estimate when switching from incandescent bulbs to LEDs\r\n\r\nNumber of E27 lightbulbs in use: -1\r\nRetry! Must be &gt; 0\r\n&gt; -3\r\nRetry! Must be &gt; 0\r\n&gt; -5\r\nRetry! Must be &gt; 0\r\n&gt; 8\r\nAverage hours per day the bulbs are turned on for: 7\r\n\r\nResults are calculated for a 30-day month.\r\n\r\nUsing 60 W incandescent bulbs consumes 100800 W, costing 15.62 EUR\r\nUsing 9 W LED bulbs consumes 15120 W, costing 2.34 EUR\r\nThat's a saving of 13.28 EUR.\r\nAt the price of 0.69, you could buy 19 packs of instant noodles with that money!<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"Task_2_W04-2_Sequence_generator\"><\/span>Task 2 [W04-2]: Sequence generator<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>In this task, you will create a program that generates two different number sequences (progressions) &#8211; arithmetic and geometric. This task is expanded with an extra task, improving visuals and adding a prime number generator.<\/p>\n<p>Follow the step-by-step guide to complete this task!<\/p>\n<p><strong>Download the starter code: <a href=\"https:\/\/blue.pri.ee\/ttu\/files\/iax0583\/aluskoodid\/4_2_sequence_gen_template.c\">https:\/\/blue.pri.ee\/ttu\/files\/iax0583\/aluskoodid\/4_2_sequence_gen_template.c<\/a><\/strong><\/p>\n<h4><span class=\"ez-toc-section\" id=\"Requirements-2\"><\/span>Requirements<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li>Complete all the functions as instructed by the function comments and the step-by-step guide below the requirements section on this page.<\/li>\n<li>The program contains both arithmetic sequence (arithmetic progression) and geometric sequence (geometric progression) generators.<\/li>\n<li>User is allowed to select which generator they want to use and the parameters for the sequence<\/li>\n<li>Initial values for sequences and ratios must allow for floats<\/li>\n<li>Results must be printed with 2 decimal places<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"Step-by-step_guide\"><\/span>Step-by-step guide<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ol>\n<li>Compile the code. See what works, what doesn&#8217;t. Read through the code.<\/li>\n<li>Add the call to the <span class=\"lang:c highlight:0 decode:true crayon-inline\">PrintMenu()<\/span>\u00a0 function into <span class=\"lang:c highlight:0 decode:true crayon-inline\">main()<\/span> . Look for the <strong>TODO<\/strong> comment.\u00a0 Write the function call below it. If it works, delete the TODO comment.<br \/>\n<strong>TEST THAT IT WORKS <span style=\"color: #ff0000;\">BEFORE<\/span> MOVING ON!<\/strong><\/li>\n<li>Complete the <span class=\"lang:c highlight:0 decode:true crayon-inline\">PrintSeparator()<\/span>\u00a0 function. You need to <strong>write a loop<\/strong> to print exactly the number of <span class=\"lang:c highlight:0 decode:true crayon-inline \">#<\/span>\u00a0 symbols on the screen that was given as the function parameters.<br \/>\n<strong>TEST THAT IT WORKS <span style=\"color: #ff0000;\">BEFORE<\/span> MOVING ON!<\/strong><\/li>\n<li>Complete the <span class=\"lang:c highlight:0 decode:true crayon-inline\">PrintAsciiWelcomeMsg()<\/span>\u00a0 function by adding some ASCII art of your own preference (image, text, ..) . You can use text or image to ASCII art converters or use already existing ASCII art galleries to find something you like.<br \/>\n<strong>TEST THAT IT WORKS <span style=\"color: #ff0000;\">BEFORE<\/span> MOVING ON!<\/strong><br \/>\nTIP: There are many online resources for galleries and converters. One of such is <strong><a href=\"https:\/\/www.asciiart.eu\">https:\/\/www.asciiart.eu<\/a><\/strong><br \/>\n<span style=\"color: #ff0000;\"><strong>NB!<\/strong> <\/span>Some commonly used symbols in ASCII, such as <span class=\"lang:c highlight:0 decode:true crayon-inline \">\\<\/span>\u00a0 (escape sequence) or\u00a0 <span class=\"lang:c highlight:0 decode:true crayon-inline\">%<\/span>\u00a0 (format specifiers) have reserved meaning in C. To print <span class=\"lang:c highlight:0 decode:true crayon-inline \">\\<\/span>\u00a0, you need to write <span class=\"lang:c highlight:0 decode:true crayon-inline \">\\\\<\/span>\u00a0 and to print <span class=\"lang:c highlight:0 decode:true crayon-inline\">%<\/span>\u00a0 you need to write <span class=\"lang:c highlight:0 decode:true crayon-inline\">%%<\/span>. An easy way to handle this is put the art into a new file and do a document-wide replacement for the unwanted character (ctrl+h in Geany).<\/li>\n<li>Go to <span class=\"lang:c highlight:0 decode:true crayon-inline \">ArithmeticSequence()<\/span>\u00a0 function.\n<ol>\n<li>Declare the missing variables (you need 3 in total)<\/li>\n<li>Add the prompts for user input and store the input into the variables declared.<\/li>\n<li>Write a function call the function <span class=\"lang:c highlight:0 decode:true crayon-inline\">ArithmeticSequenceGenerator()<\/span>\u00a0\u00a0with the required parameters.<br \/>\n<strong>NB!<\/strong> The function <span class=\"lang:c highlight:0 decode:true crayon-inline\">ArithmeticSequenceGenerator()<\/span>\u00a0 is commented out from the code to avoid excess compiler warnings on unused variables. Until you comment that function in, you will see an &#8220;undefined reference&#8221; error and the program will not compile! Comment the function in so you can compile and test!<br \/>\n<strong>TEST THAT IT WORKS <span style=\"color: #ff0000;\">BEFORE<\/span> MOVING ON!<\/strong><\/li>\n<\/ol>\n<\/li>\n<li>Go to the function <span class=\"lang:c highlight:0 decode:true crayon-inline\">ArithmeticSequenceGenerator()<\/span>\u00a0 and complete it. You need to write a loop, that has 2 statements\n<ol>\n<li>Print the <strong>current value<\/strong> of the sequence.<\/li>\n<li>Calculate <strong>the next value<\/strong> in the sequence.<br \/>\nNB! This order is important!<br \/>\nHint 1: next_value = current_value + common_difference<br \/>\nHint 2: You don&#8217;t need any other variables besides the loop counter.\u00a0<strong>Do not use arrays! (future topic).<\/strong><br \/>\n<strong>TEST THAT IT WORKS <span style=\"color: #ff0000;\">BEFORE<\/span> MOVING ON!<\/strong><\/li>\n<\/ol>\n<\/li>\n<li>The <span class=\"lang:c highlight:0 decode:true crayon-inline\">switch ()<\/span>\u00a0 statement handling the user input only has one case specified. Add the other 2 cases that are missing from it (You can see that they are listed as menu options by the <span class=\"lang:c highlight:0 decode:true crayon-inline \">PrintMenu()<\/span>\u00a0 function<\/li>\n<li>In the same manner you completed the arithmetic sequence, complete the two functions for geometric sequence.<\/li>\n<\/ol>\n<p>Now the task should be complete. Compare your output to the testing output below.<\/p>\n<h4><span class=\"ez-toc-section\" id=\"Testing-2\"><\/span>Testing<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>Make sure to test through all 3 menu options and invalid input!<\/p>\n<p><strong>Testing the arithmetic sequence generator<\/strong><\/p>\n<pre class=\"theme:cisco-router toolbar:1 nums:false lang:default highlight:0 decode:true\">  ________                                   __\r\n \/  _____\/  ____   ____   ________________ _\/  |_  ___________\r\n\/   \\  ____\/ __ \\ \/    \\_\/ __ \\_  __ \\__  \\\\   __\\\/  _ \\_  __ \\\r\n\\    \\_\\  \\  ___\/|   |  \\  ___\/|  | \\\/\/ __ \\|  | (  &lt;_&gt; )  | \\\/\r\n \\______  \/\\___  &gt;___|  \/\\___  &gt;__|  (____  \/__|  \\____\/|__|\r\n        \\\/     \\\/     \\\/     \\\/           \\\/\r\n\r\n#################################################################\r\n#  1 - Arithmetic sequence generator                            #\r\n#  2 - Geometric sequence generator                             #\r\n#  0 - exit                                                     #\r\n#################################################################\r\nEnter selection\r\n&gt; 1\r\n#################################################################\r\nArithmetic sequence generator\r\n#################################################################\r\nEnter number of result: 8\r\nEnter starting value: 1.5\r\nEnter common difference: 2.25\r\n#################################################################\r\nResults\r\n1.50 3.75 6.00 8.25 10.50 12.75 15.00 17.25\r\n#################################################################<\/pre>\n<p><strong>Testing the geometric sequence generator<\/strong><\/p>\n<pre class=\"theme:cisco-router toolbar:1 nums:false lang:default highlight:0 decode:true\">  ________                                   __\r\n \/  _____\/  ____   ____   ________________ _\/  |_  ___________\r\n\/   \\  ____\/ __ \\ \/    \\_\/ __ \\_  __ \\__  \\\\   __\\\/  _ \\_  __ \\\r\n\\    \\_\\  \\  ___\/|   |  \\  ___\/|  | \\\/\/ __ \\|  | (  &lt;_&gt; )  | \\\/\r\n \\______  \/\\___  &gt;___|  \/\\___  &gt;__|  (____  \/__|  \\____\/|__|\r\n        \\\/     \\\/     \\\/     \\\/           \\\/\r\n\r\n#################################################################\r\n#  1 - Arithmetic sequence generator                            #\r\n#  2 - Geometric sequence generator                             #\r\n#  0 - exit                                                     #\r\n#################################################################\r\nEnter selection\r\n&gt; 2\r\n#################################################################\r\nGeometric sequence generator\r\n#################################################################\r\nEnter number of result: 10\r\nEnter starting value: 1\r\nEnter common ratio: 1.5\r\n#################################################################\r\nResults\r\n1.00 1.50 2.25 3.38 5.06 7.59 11.39 17.09 25.63 38.44\r\n#################################################################<\/pre>\n<p><strong>Exiting without using<\/strong><\/p>\n<pre class=\"theme:cisco-router toolbar:1 nums:false lang:default highlight:0 decode:true\">  ________                                   __\r\n \/  _____\/  ____   ____   ________________ _\/  |_  ___________\r\n\/   \\  ____\/ __ \\ \/    \\_\/ __ \\_  __ \\__  \\\\   __\\\/  _ \\_  __ \\\r\n\\    \\_\\  \\  ___\/|   |  \\  ___\/|  | \\\/\/ __ \\|  | (  &lt;_&gt; )  | \\\/\r\n \\______  \/\\___  &gt;___|  \/\\___  &gt;__|  (____  \/__|  \\____\/|__|\r\n        \\\/     \\\/     \\\/     \\\/           \\\/\r\n\r\n#################################################################\r\n#  1 - Arithmetic sequence generator                            #\r\n#  2 - Geometric sequence generator                             #\r\n#  0 - exit                                                     #\r\n#################################################################\r\nEnter selection\r\n&gt; 0\r\n#################################################################\r\nExiting ...\r\n#################################################################<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"Task_3_W04-3_Appointment_planner\"><\/span>Task 3 [W04-3]: Appointment planner<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>In this task, you will create a simple time generator for appointments.<\/p>\n<p><strong>Download the starter code:<\/strong> <strong><a href=\"https:\/\/blue.pri.ee\/ttu\/files\/iax0583\/aluskoodid\/4_3_timetable_template.c\">https:\/\/blue.pri.ee\/ttu\/files\/iax0583\/aluskoodid\/4_3_timetable_template.c<\/a><\/strong><\/p>\n<h4><span class=\"ez-toc-section\" id=\"Requirements-3\"><\/span>Requirements<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li>The start of the workday is defined<\/li>\n<li>User must enter the number of clients and the duration of an appointment<\/li>\n<li>Program will generate consecutive appointment times for the clients<\/li>\n<li>Must implement and use at least the given list of function. If you wish, you can implement extra functions.<\/li>\n<li>Generated appointment times must be valid<\/li>\n<li>Output must be visually aligned<\/li>\n<li>All functions are given as names only. You must give all of them return types and parameters. Note, that if there are no parameters, void must be written into the parenthesis.<\/li>\n<li>The calculation of the time is given to you as an algorithm<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"Time_calculation_algorithm\"><\/span>Time calculation algorithm<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><a href=\"https:\/\/blue.pri.ee\/ttu\/wp-content\/uploads\/2023\/09\/appointments.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-8879\" src=\"https:\/\/blue.pri.ee\/ttu\/wp-content\/uploads\/2023\/09\/appointments.png\" alt=\"\" width=\"999\" height=\"772\" srcset=\"https:\/\/blue.pri.ee\/ttu\/wp-content\/uploads\/2023\/09\/appointments.png 999w, https:\/\/blue.pri.ee\/ttu\/wp-content\/uploads\/2023\/09\/appointments-300x232.png 300w, https:\/\/blue.pri.ee\/ttu\/wp-content\/uploads\/2023\/09\/appointments-768x593.png 768w\" sizes=\"auto, (max-width: 999px) 100vw, 999px\" \/><\/a><\/p>\n<h4><span class=\"ez-toc-section\" id=\"Approach\"><\/span>Approach<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>This task is given to you as more of a bare-bones structure, so that you will in the end, still be able to divide your program into reasonable functions, but allow you more freedom of thought.<\/p>\n<p>For every function you implement, start by setting up a return type and parameters list. These are specified in the function comment. Once that is complete,\u00a0write the prototype for the function before the main() function. Then proceed to write the body of the function and finish by adding the call to the function in the appropriate place.<\/p>\n<div class=\"su-spoiler su-spoiler-style-fancy su-spoiler-icon-chevron su-spoiler-closed\" data-scroll-offset=\"0\" data-anchor-in-url=\"no\"><div class=\"su-spoiler-title\" tabindex=\"0\" role=\"button\"><span class=\"su-spoiler-icon\"><\/span>Open me to get some hints<\/div><div class=\"su-spoiler-content su-u-clearfix su-u-trim\">\n<ul>\n<li>First, finish the parts that are already in use or half finished &#8211; such as <span class=\"lang:c highlight:0 decode:true crayon-inline \">PrintTime()<\/span>\u00a0 and <span class=\"lang:c highlight:0 decode:true crayon-inline \">PrintTimeInterval()<\/span> . These should be easy to complete and test and get some warnings out of the way.<\/li>\n<li>Finish the GetPositiveInt() function. You&#8217;ve already written this function before in this class, just copy the body of the function, set the return value and parameter to void and you&#8217;re ready to grab the required user input from main() function (number of clients and appointment length).<\/li>\n<li>Start working with the <span class=\"lang:c highlight:0 decode:true crayon-inline \">PrintTimetable()<\/span>\u00a0 function. Call it out from main() and create a loop to print out the list of clients. Don&#8217;t worry a bout times yet.<\/li>\n<li>Next up, finish the <span class=\"lang:c highlight:0 decode:true crayon-inline \">CalcNextHour()<\/span>\u00a0 and <span class=\"lang:c highlight:0 decode:true crayon-inline \">CalcNextMin()<\/span>\u00a0 functions. Both of these are one-liners where you just need to do a calculation and return that value.<br \/>\nHint: you can test them by just calling them out randomly &#8211; i.e.<br \/>\n<span class=\"lang:c highlight:0 decode:true crayon-inline\">CalcNextHour(8, 0, 50)<\/span>\u00a0 should return 8 and <span class=\"lang:c highlight:0 decode:true crayon-inline\">CalcNextHour(8, 0, 70)<\/span> should return 9. Similarly <span class=\"lang:c highlight:0 decode:true crayon-inline \">CalcNextmin(0, 50)<\/span>\u00a0 should return 50 and\u00a0<span class=\"lang:c highlight:0 decode:true crayon-inline\">CalcNextmin(0, 70)<\/span>\u00a0 should return 10.<\/li>\n<li>Now go and start filling the loop body of your\u00a0<span class=\"lang:c highlight:0 decode:true crayon-inline \">PrintTimetable()<\/span> function. Look at the algorithm for reference.<br \/>\nNB! For this to work, you need to know both the current time and the end time (next appointment time) at the same time &#8211; so you need variables for both.\u00a0 With those 4 values, you need to call the\u00a0 <span class=\"lang:c highlight:0 decode:true crayon-inline\">PrintTimeInterval()<\/span> function.<\/li>\n<li>Now test and debug. All the parts should be there, just need to make sure they work together.<\/li>\n<\/ul>\n<\/div><\/div>\n<h4><span class=\"ez-toc-section\" id=\"Testing-3\"><\/span>Testing<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><strong>Testing with only minute number overflowing.\u00a0<\/strong><\/p>\n<pre class=\"theme:cisco-router toolbar:1 nums:false lang:default highlight:0 decode:true\">&gt;Workday starts at 8:00\r\n\r\nEnter num of clients\r\n10\r\nEnter client session length\r\n45\r\n\r\nClient  1:  8:00 -  8:45\r\nClient  2:  8:45 -  9:30\r\nClient  3:  9:30 - 10:15\r\nClient  4: 10:15 - 11:00\r\nClient  5: 11:00 - 11:45\r\nClient  6: 11:45 - 12:30\r\nClient  7: 12:30 - 13:15\r\nClient  8: 13:15 - 14:00\r\nClient  9: 14:00 - 14:45\r\nClient 10: 14:45 - 15:30<\/pre>\n<p><strong>Testing with hours also overflowing<\/strong><\/p>\n<pre class=\"theme:cisco-router toolbar:1 nums:false lang:default highlight:0 decode:true\">Workday starts at 8:00\r\n\r\nEnter num of clients\r\n25\r\nEnter client session length\r\n45\r\n\r\nClient  1:  8:00 -  8:45\r\nClient  2:  8:45 -  9:30\r\nClient  3:  9:30 - 10:15\r\nClient  4: 10:15 - 11:00\r\nClient  5: 11:00 - 11:45\r\nClient  6: 11:45 - 12:30\r\nClient  7: 12:30 - 13:15\r\nClient  8: 13:15 - 14:00\r\nClient  9: 14:00 - 14:45\r\nClient 10: 14:45 - 15:30\r\nClient 11: 15:30 - 16:15\r\nClient 12: 16:15 - 17:00\r\nClient 13: 17:00 - 17:45\r\nClient 14: 17:45 - 18:30\r\nClient 15: 18:30 - 19:15\r\nClient 16: 19:15 - 20:00\r\nClient 17: 20:00 - 20:45\r\nClient 18: 20:45 - 21:30\r\nClient 19: 21:30 - 22:15\r\nClient 20: 22:15 - 23:00\r\nClient 21: 23:00 - 23:45\r\nClient 22: 23:45 -  0:30\r\nClient 23:  0:30 -  1:15\r\nClient 24:  1:15 -  2:00\r\nClient 25:  2:00 -  2:45<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"Extra_tasks\"><\/span>Extra tasks<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>This lab has two extra tasks, that are additive to the base tasks. The first extra task expands and improves the second base task by adding prime numbers and limits line length. The second extra task allows settings breaks and handles multiday bookings.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Extra_task_1_W04-4_Prime_numbers_and_results_per_line\"><\/span>Extra task 1 [W04-4]: Prime numbers and results per line<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>This task expands on the base task completed in the lab.<\/p>\n<h4><span class=\"ez-toc-section\" id=\"Requirements-4\"><\/span>Requirements<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li>Use the completed lab task 2 as the base for this lab task<\/li>\n<li>Add a prime number generator. Use the given function (below requirements)\u00a0 in your code!<\/li>\n<li>Add a limit for the line length so that the output would look nicer. For this, there are two allowed solutions, pick a preferred one\n<ul>\n<li>Easier: limit based on the number of results. It will look a little worse, but this is something you already know how to solve.<\/li>\n<li>Complicated: limit based on the characters printed (hint: one possible option is based on the return value of <span class=\"lang:c highlight:0 decode:true  crayon-inline \">snprintf()<\/span>\u00a0 funktsion).<\/li>\n<\/ul>\n<\/li>\n<li>Add a limit to how many results per line will each generator print. Find a suitable limit on your own.<br \/>\n<em>Alternative: If you wish to make it look fancier, you can also count characters to avoid breaking the width of the application. Functions such as <span class=\"lang:c highlight:0 decode:true crayon-inline\">snprintf()<\/span>\u00a0 can help with this.<\/em><\/li>\n<\/ul>\n<ul>\n<li style=\"list-style-type: none;\"><\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"Testing_for_prime_function\"><\/span>Testing for prime function<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>Use this function as a part of the prime number generator. Note you will also need to add the <span class=\"lang:c highlight:0 decode:true  crayon-inline \">IS_PRIME<\/span>\u00a0 macro to your code!<\/p>\n<p>Hint: Function return values can be directly used in <span class=\"lang:c highlight:0 decode:true crayon-inline \">if<\/span>\u00a0 statements: <strong><a href=\"https:\/\/blue.pri.ee\/ttu\/coding-guides\/conditional-statements\/#Function_calls_in_conditionals\">https:\/\/blue.pri.ee\/ttu\/coding-guides\/conditional-statements\/#Function_calls_in_conditionals<\/a><\/strong><\/p>\n<pre class=\"toolbar:2 lang:c decode:true\">\/**\r\n * Description:    Checks if a number is a prime or not.\r\n *\r\n * Parameters:     num - number to test for\r\n *\r\n * Return:         IS_PRIME (defined 1) when num is a prime, !IS_PRIME (0) \r\n *                 if it was not.\r\n *\/\r\nint IsPrime(int num)\r\n{\r\n    \/* Sanity check to avoid misuse of this function *\/\r\n    if (num &lt;= 0)\r\n    {\r\n        return !IS_PRIME;\r\n    }\r\n    \r\n    \/* Check divisibility from 2 until 1 below the test value itself *\/\r\n    for (int i = 2; i &lt; num; i++)\r\n    {\r\n        \/* If it's divisible, it's not a prime *\/\r\n        if (num % i == 0)\r\n        {\r\n            return !IS_PRIME;\r\n        }\r\n    }\r\n    \r\n    \/* Number is only divisible by itself and 1, so it's a prime *\/\r\n    return IS_PRIME;\r\n}<\/pre>\n<p><strong>Testing<\/strong><\/p>\n<p>Note, that there are two different results shown. Both are correct in terms of the task completion. You only need to show one of them! Second one is for inspiration if you want to go all out and make it even nicer.<\/p>\n<p><strong>Result count<\/strong><\/p>\n<pre class=\"theme:cisco-router toolbar:1 nums:false lang:default highlight:0 decode:true \">  ________                                   __\r\n \/  _____\/  ____   ____   ________________ _\/  |_  ___________\r\n\/   \\  ____\/ __ \\ \/    \\_\/ __ \\_  __ \\__  \\\\   __\\\/  _ \\_  __ \\\r\n\\    \\_\\  \\  ___\/|   |  \\  ___\/|  | \\\/\/ __ \\|  | (  &lt;_&gt; )  | \\\/\r\n \\______  \/\\___  &gt;___|  \/\\___  &gt;__|  (____  \/__|  \\____\/|__|\r\n        \\\/     \\\/     \\\/     \\\/           \\\/\r\n\r\n#################################################################\r\n#  1 - Arithmetic sequence generator                            #\r\n#  2 - Geometric sequence generator                             #\r\n#  3 - Prime number generator (result count)                    #\r\n#  4 - Prime number generator (line length)                     #\r\n#  0 - exit                                                     #\r\n#################################################################\r\nEnter selection\r\n&gt; 3\r\n#################################################################\r\nPrime numbers generator\r\n#################################################################\r\nInsert upper bound: 550\r\n#################################################################\r\nResults\r\n\r\n1 2 3 5 7 11 13 17 19 23 29\r\n31 37 41 43 47 53 59 61 67 71 73\r\n79 83 89 97 101 103 107 109 113 127 131\r\n137 139 149 151 157 163 167 173 179 181 191\r\n193 197 199 211 223 227 229 233 239 241 251\r\n257 263 269 271 277 281 283 293 307 311 313\r\n317 331 337 347 349 353 359 367 373 379 383\r\n389 397 401 409 419 421 431 433 439 443 449\r\n457 461 463 467 479 487 491 499 503 509 521\r\n523 541 547\r\n#################################################################<\/pre>\n<p><strong>Line character count<\/strong><\/p>\n<pre class=\"theme:cisco-router toolbar:1 nums:false lang:default highlight:0 decode:true\">  ________                                   __\r\n \/  _____\/  ____   ____   ________________ _\/  |_  ___________\r\n\/   \\  ____\/ __ \\ \/    \\_\/ __ \\_  __ \\__  \\\\   __\\\/  _ \\_  __ \\\r\n\\    \\_\\  \\  ___\/|   |  \\  ___\/|  | \\\/\/ __ \\|  | (  &lt;_&gt; )  | \\\/\r\n \\______  \/\\___  &gt;___|  \/\\___  &gt;__|  (____  \/__|  \\____\/|__|\r\n        \\\/     \\\/     \\\/     \\\/           \\\/\r\n\r\n#################################################################\r\n#  1 - Arithmetic sequence generator                            #\r\n#  2 - Geometric sequence generator                             #\r\n#  3 - Prime number generator (result count)                    #\r\n#  4 - Prime number generator (line length)                     #\r\n#  0 - exit                                                     #\r\n#################################################################\r\nEnter selection\r\n&gt; 4\r\n#################################################################\r\nPrime numbers generator\r\n#################################################################\r\nInsert upper bound: 525\r\n#################################################################\r\nResults\r\n\r\n1 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79\r\n83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167\r\n173 179 181 191 193 197 199 211 223 227 229 233 239 241 251 257\r\n263 269 271 277 281 283 293 307 311 313 317 331 337 347 349 353\r\n359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449\r\n457 461 463 467 479 487 491 499 503 509 521 523\r\n#################################################################<\/pre>\n<h3><span class=\"ez-toc-section\" id=\"Extra_task_2_W04-5_Add_breaks_and_end-of-day\"><\/span>Extra task 2 [W04-5]: Add breaks and end-of-day.<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>This task expands on the base task completed in the lab.<\/p>\n<h4><span class=\"ez-toc-section\" id=\"Requirements-5\"><\/span>Requirements<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li>Use the completed lab task 3 as the base for this lab task.<\/li>\n<li>Add a configurable break between each client appointment (i.e. 10 min between clients)<\/li>\n<li>Add a limit to how long a workday is (i.e. 8 hours. if a client&#8217;s appointment would go beyond the current work day, put that and all the following appointments to the next day. If multiple days are required, add day counter.<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"Testing-4\"><\/span>Testing<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>Example of expected output for multiday scheduling<\/p>\n<pre class=\"theme:cisco-router toolbar:1 nums:false lang:default highlight:0 decode:true\">Using advanced version of the task\r\nWorkday starts at  8:00\r\nWorkday ends at 16:00\r\n\r\nEnter num of clients\r\n25\r\nEnter client session length\r\n35\r\nEnter break length\r\n10\r\n\r\nDay 1\r\n        Client  1:       8:00 -  8:35\r\n        Client  2:       8:45 -  9:20\r\n        Client  3:       9:30 - 10:05\r\n        Client  4:      10:15 - 10:50\r\n        Client  5:      11:00 - 11:35\r\n        Client  6:      11:45 - 12:20\r\n        Client  7:      12:30 - 13:05\r\n        Client  8:      13:15 - 13:50\r\n        Client  9:      14:00 - 14:35\r\n        Client 10:      14:45 - 15:20\r\nDay 2\r\n        Client 11:       8:00 -  8:35\r\n        Client 12:       8:45 -  9:20\r\n        Client 13:       9:30 - 10:05\r\n        Client 14:      10:15 - 10:50\r\n        Client 15:      11:00 - 11:35\r\n        Client 16:      11:45 - 12:20\r\n        Client 17:      12:30 - 13:05\r\n        Client 18:      13:15 - 13:50\r\n        Client 19:      14:00 - 14:35\r\n        Client 20:      14:45 - 15:20\r\nDay 3\r\n        Client 21:       8:00 -  8:35\r\n        Client 22:       8:45 -  9:20\r\n        Client 23:       9:30 - 10:05\r\n        Client 24:      10:15 - 10:50\r\n        Client 25:      11:00 - 11:35<\/pre>\n<h2><span class=\"ez-toc-section\" id=\"After_this_class_you_should\"><\/span>After this class, you should<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li>Be aware of simple padding and alignment modifiers\n<ul>\n<li>padding integers with spaces and zeros<\/li>\n<li>padding floating point values<\/li>\n<li>padding and left-aligning strings<\/li>\n<li>stripping the ends of too long strings<\/li>\n<\/ul>\n<\/li>\n<li>Know the difference between a local and a global variable<\/li>\n<li>Understand what a function is and why it is important to use them<\/li>\n<li>Understand that we have been using functions from the first week. Both functions that return values and those that don\u2019t!<\/li>\n<li>Understand, that we can create functions just like those we have been using.<\/li>\n<li>Understand the following terms\n<ul>\n<li>Function prototype<\/li>\n<li>Function return type<\/li>\n<li>Function arguments<\/li>\n<li>Function parameters<\/li>\n<li>Function header<\/li>\n<li>Function body<\/li>\n<\/ul>\n<\/li>\n<li>Be able to create proper functions<\/li>\n<li>Be able to pass values (constants, macros, through variables) to functions<\/li>\n<li>Be able to store the value returned from a function<\/li>\n<li>Be able to decompose your code into smaller functions<\/li>\n<li><strong>Have a small list of universal functions that you can reuse in future codes! This list of functions will increase every week from now on.<\/strong><\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"Additional_content\"><\/span><strong>Additional content<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li>Format specifiers for printf<br \/>\n<strong><a href=\"https:\/\/cplusplus.com\/reference\/cstdio\/printf\/\">https:\/\/cplusplus.com\/reference\/cstdio\/printf\/<\/a><\/strong><\/li>\n<li>Complete printf specification<br \/>\n<strong><a href=\"https:\/\/en.cppreference.com\/w\/c\/io\/fprintf\">https:\/\/en.cppreference.com\/w\/c\/io\/fprintf<\/a><\/strong><\/li>\n<li>Functions in C<br \/>\n<a href=\"https:\/\/www.studytonight.com\/c\/user-defined-functions-in-c.php\"><strong>https:\/\/www.studytonight.com\/c\/user-defined-functions-in-c.php<\/strong><\/a><\/li>\n<li>C functions<br \/>\n<strong><a href=\"https:\/\/www.geeksforgeeks.org\/c-functions\/\">https:\/\/www.geeksforgeeks.org\/c-functions\/<\/a><\/strong><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Lab material Additional topic: Padding and alignment Slides:\u00a0Functions Lab demo codes zipped: https:\/\/blue.pri.ee\/ttu\/files\/iax0583\/programmikood\/wk4_samples.zip Lab tasks In this lab, you have a total of three lab tasks. All tasks have starter codes that will set the structure of the final solution and give you a planned workflow, which mostly is given as step-by-step instructions. Tasks number &hellip; <a href=\"https:\/\/blue.pri.ee\/ttu\/labs\/pr1_en\/pr1en4-functions\/\" class=\"more-link\">Loe edasi <span class=\"screen-reader-text\">PR1EN4: Functions<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[77],"tags":[],"class_list":["post-8846","post","type-post","status-publish","format-standard","hentry","category-pr1_en"],"_links":{"self":[{"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/posts\/8846","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/comments?post=8846"}],"version-history":[{"count":43,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/posts\/8846\/revisions"}],"predecessor-version":[{"id":11502,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/posts\/8846\/revisions\/11502"}],"wp:attachment":[{"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/media?parent=8846"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/categories?post=8846"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/tags?post=8846"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}