To gain experience writing functions and using recursion.
-
Write a program
three.c
that takes in 3 user-input integers and checks whether or not the 3 integers form a valid triangle (no one side is longer than the sum of the other 2 sides). It should contain the following functions:isTriangle()
, which determines whether the integers form a valid triangletriangleType()
, which determines whether the triangle is equilateral (all sides are equal), isoceles (only 2 sides are equal), or scalene (no sides are equal) and prints a message as appropriatesanitizedInput()
, which ensures that the user-input integers are valid
-
Write a program
palindrome.c
using recursion to test if a word/phrase is a palindrome (something that reads the same if the letters are reversed, such as racecar).
In a text file assignment5.txt
, answer the following questions:
-
What do each of the following mean? Include a description of the syntax or an example.
- Passing by value:
- Passing by reference:
-
What is the function of the return statement in C?
-
What is the purpose of writing functions?
Please include your name and a description in a comment at the top of your code files. Please also include your name at the top of your assignment5.txt file.
All files must be submitted via GitHub by 10:10am 7/29.