{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Assignment 3

# Assignment 3 - Assignment 3 1 Create pico file a3_input...

This preview shows pages 1–3. Sign up to view the full content.

Assignment 3: 1). Create pico file a3_input.txt List the following numbers in a single column 10.0 5.0 13.2 2.0 22 2). Create pico file math_functions.c /*Program name: Math Functions Author: Michelle Abercrombie Date Created: 02/12/2008 This file converts an input from degrees to radians, calculates the distance between two points, and how many digits it takes to represent a number in base b notaion, and prints the results into an output file a_3output.txt.*/ #include <stdio.h> #include <math.h> double degrees_to_radians(double x) /*This is the function which converts an input, x from degrees to radians*/ { double angle; angle = x*0.0174532925; return angle; } double compute_distance(double x1, double y1, double x2, double y2)/*This function computes the distance between two points (x1,y1), (x2,y2).*/ { double distance; distance = sqrt(((x1-x2)*(x1-x2)) + ((y1-y2)*(y1-y2))); return distance; } double num_to_digits_in_base(int x, int b)/*This function conputes the number of digits needed to represent a number, x, in base b notation*/ {

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
int number; number = (int)(log10(x)/log10(b))+1; return number; } main() {
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 3

Assignment 3 - Assignment 3 1 Create pico file a3_input...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online