Write a program that reads the radius of a circle (as a float value) and computes and prints the diameter, the circumference and the area. Use the value 3.14159 for π.
C Program:
C Program:
#include <stdio.h>Output:
int main(){
float jari, diameter, keliling, luas;
printf("Masukan jari-jari: ");
scanf("%f", &jari);
diameter = 2*jari;
keliling = 3.14159*2*jari;
luas = 3.14159*jari*jari;
printf("Diameter\t: %.2f\n", diameter);
printf("Keliling\t: %.2f\n", keliling);
printf("Luas\t: %.2f\n", luas);
system("pause");
return 0;
}
0 komentar:
Posting Komentar