#include <stdio.h> #include <conio.h> #define PI 3.14159 float cal(float radius); int main() { int i; float area, radius; printf("To stop program insert value of radius = 0..."); printf("\n Radius of circle: "); scanf("%f", &radius); for (i = 0; radius != 0; i++) { if (radius < 0) { area = 0; } else { area = cal(radius); } printf("Area of Circle is %f \n", area); scanf("%f", &radius); } } float cal(float r) { float a; a = PI * r * r; return (a); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter