Professional Documents
Culture Documents
2. Write a function named area to calculate the area of a triangle. The function accepts the six coordinate points (x1, y1, x2, y2, x3, y3). The function area will call another function named arms to calculate the lengths (a, b, c) of the three arms of the triangle using corresponding coordinates. Then using the values a, b, and c function area will calculate the area. 3. ***Do the problems (which can be done) in doc-2 using function calling. Such as, to check a number is prime or not, take input from the user in main function then pass the value to another function namely prime_check to check whether it is prime or not. And in case of series evolution problems, take the value of x and n (according to
Bibekananda Datta, MechE, BUET 2013 https://sites.google.com/site/bibekanandadatta
necessity) and pass them to another function name sum_up (also make functions namely power and factorial, if necessary) to evaluate the sum. In case building structure, take line number as input from the user in main function and then pass it to another function to print the structures on the computer screen. 4. ***Do the problems (which can be done) in doc-3 using function calling. Such as to add/transpose the matrix pass matrix/matrices to another function which will add them/transpose it. In case of string problems, it is preferred to build your own function without using library functions (not in all case, in most of the cases). 5. Write a program which will take number as input and find its factorial value using recursive call. 6. Use recursive call to evaluate the series in doc-2. 7. Evaluate nCr or nPr by using recursive function. 8. Write a program which will take two numbers as input and swap them by using pass by reference protocol.