K&R Exercises

Exercise 5-2: getfloat

Write getfloat, the floating-point analog of getint. What type does getfloat return as its function value?

A number is an optional sign, then digits with at most one decimal point, with at least one digit. Use getfloat in a program that prints each number in its input with printf("%g\n", ...), including one right at the end of the input, and skips any character that doesn't start a number.

Test Cases

· space→ tab↵ newline

Submissions

No submissions yet