Answered step by step
Verified Expert Solution
Question
1 Approved Answer
b) Write a complete C program that reads in the last 2 digits of your student ID into two separate variables. The program calculates the
b) Write a complete C program that reads in the last 2 digits of your student ID into two separate variables. The program calculates the absolute difference of the 2 digits and displays a triangle shape of that size using for loops. If the absolute difference between the last 2 digits of your student ID is less than 5, then your program needs to add 5 to that value to display an appropriately sized triangle. Below is an example of the shape that would be displayed by the program, if the last two digits of your student ID are 0 and 1 (the absolute difference is 1 and after adding 5, the size (and thus height) of the triangle is 6): XXXXXXXXXXX X X x x X X X Notes: 1. You can assume that the character x is always used to draw the triangle shape. 2. Your program must include and make use of at least one user-defined function prototype, to ensure code reusability. 3. The program's variables must be sensibly named. 4. The code must include comments that are meaningful, short and clear, to explain all major parts of the program. markel
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started