# Lab4 - p getchar getchar g*ask for...

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

Sheet1 Page 1 #include <stdio.h> #include <stdlib.h> #include <math.h> int main() { /*declare and initialize variables and functions*/ double n, d, linecount, count_digits(double n, double d) void print_line(double linecount) v /*do-loop*/ do { /*prompt user input*/ printf("Enter the numerator and denomenator:") s count_digits(n, d) c printf("%lf\n", n) p print_line(linecount) printf("\n%lf\n", d) p printf("Enter another set of numbers(Y for yes)?")

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: p getchar() getchar() g /*ask for repeat*/ }while(getchar()== ('Y')) } /*end program*/ return EXIT_SUCCESS } #include <stdio.h> void print_line(double linecount) { int N=0 do { printf("-") N = N++ N Sheet1 Page 2 }while(N < linecount) return } #include <math.h> double count_digits(double n, double d) { double linecount if(n > d) linecount = ceil(log10(n)) if(d > n) linecount = ceil(log10(d)) l return linecount }...
View Full Document

## This lab report was uploaded on 04/17/2008 for the course CS 1023 taught by Professor Kerstetter during the Spring '08 term at Western Michigan.

### Page1 / 2

Lab4 - p getchar getchar g*ask for...

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

View Full Document
Ask a homework question - tutors are online