areac - scanf("%lf%lf", &x, &y) output =...

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

View Full Document Right Arrow Icon
Sheet1 Page 1 /* area.c */ #include <stdio.h> #include "func.h" int main() { double x, y, r double output int index printf("Enter 1 [area of square], 2 [area of rectangle], 3 [area of trangle], or 4 [area of circle]: ") if(index == 1) { printf("Enter a length: ") output = square(x) } else if(index == 2) { printf("Enter a length and height: ")
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: scanf("%lf%lf", &x, &y) output = rectangle(x, y) } else if(index==3){ printf("Enter a length and height: ") scanf("%lf%lf", &x, &y) output = triangle(x, y) } else if(index==4){ printf("Enter a radius: ") scanf("%lf", &r) output = circle(r) } else { printf("ERROR: invalid entry\n") } printf("Output = %f\n", output) return 0 }...
View Full Document

This note was uploaded on 04/18/2008 for the course EME 5 taught by Professor Staff during the Fall '08 term at UC Davis.

Ask a homework question - tutors are online