assignment03 - the triangle is equilateral; (b) the...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
ECE 175 - Computer Programming for Engineering Applications Assignment #3 Due on September 25, 2008 [Thursday] by 11.59 PM. Note that this assignment can be solved in groups of two students. It is sufficient to submit one assignment per group. Please make sure every program contains the name of both the students in the group. Reading assignment: Chapters covering functions, math library, and conditional statements. 1. Write a program num-digits.c which takes a decimal positive integer x . The program prints the number of digits required to represent the decimal integer x in bases 2, 4, 8, and 16. For example: If the input is 18, then the output should be: Given decimal number: 18 Number of digits required in base 2: 5 Number of digits required in base 4: 3 Number of digits required in base 8: 2 Number of digits required in base 16: 2 2. Write a program that takes three distance values a, b, and c and identi±es if a triangle can be formed whose sides have the three given lengths. If a triangle can be formed, then if the triangle satis±es the following properties: (a)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: the triangle is equilateral; (b) the triangle is isosceles (if it is not equilateral); and (c) the triangle is a right-angled triangle. Your output should appear as below, with the correct answer printed for each question. Can a triangle can be formed with the given lengths? Yes / No Is the triangle equilateral? Yes / No / Not applicable If the triangle is not equilateral, it is isosceles? Yes / No / Not applicable Is the triangle right-angled? Yes / No / Not applicable Call this program triangle.c. 3. Write a program that takes a two-digit integer (-99 to +99) as an input and outputs the number in words. If the input is outside this range, the program should print that it is outside the range. Use switch statement when you want to check equality and if statement if you are checking for range. Call this program number-words.c. Turnin Instructions Turnin the “C” program ±le using the following statement. turnin ece175 assignment3 num-digits.c triangle.c number-words.c...
View Full Document

This note was uploaded on 08/24/2010 for the course ECE 175 taught by Professor Grubbs during the Fall '08 term at Arizona.

Ask a homework question - tutors are online