Lab4 - p getchar() getchar() g /*ask for repeat*/...

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

View Full Document Right Arrow Icon
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)?")
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
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 &lt;stdio.h&gt; void print_line(double linecount) { int N=0 do { printf(&quot;-&quot;) N = N++ N Sheet1 Page 2 }while(N &lt; linecount) return } #include &lt;math.h&gt; double count_digits(double n, double d) { double linecount if(n &gt; d) linecount = ceil(log10(n)) if(d &gt; n) linecount = ceil(log10(d)) l return linecount }...
View Full Document

Page1 / 2

Lab4 - p getchar() getchar() g /*ask for repeat*/...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online