All pastes #243802 Raw Edit

Anonymous

public c v1 · immutable
·published 2006-11-08 22:04 UTC
rendered paste body
/************************************************* Remy's Circle Equation Calculation Program **************************************************/#include <stdio.h>#include <stdlib.h>#include <conio.h>#include <ctype.h>#define PI 3.14float a, c, r, x;char quit;float area(void);float circ(void);int main(){	do {		printf("Press A for area, C for circumference.\n");		c=toupper(getch());				if (c=='A')		{			printf("You chose area.\n");			printf("Enter the radius:");	   			a=area();			printf("The area of the circle is %f.\n",a);				printf("Do you want to quit? Y/\N?\n");			quit=toupper(getch());		}			else if (c=='C')		{			printf("You chose circumference.\n");			printf("Enter the radius:");				c=circ();			printf("The circumference of the circle is %f.\n",c);					printf("Do you want to quit? Y/\N?\n");			quit=toupper(getch());		}		else		{			printf("Invalid choice.\n");					printf("Do you want to quit? Y/\N?\n");			quit=toupper(getch());		}	}	while (quit == 'N');		return 0;}float area(void){	scanf("%f", &r);	x=PI*(r*r);	return(x);}	float circ(void){	scanf("%f", &r);	x=2*PI*r;	return(x);}