Bài 1: Viết chương trình tính thể tích hình cầu khi biết diện tích của hình đó. 08/08/2021 Bởi Harper Bài 1: Viết chương trình tính thể tích hình cầu khi biết diện tích của hình đó.
#include <stdio.h> #include <conio.h> #include <math.h> #define PI 3.14159 int main() { int r; float s, v; printf (“Nhap ban kinh r: “); scanf(“%d”, &r); s = 4*PI*r*r; v = (4/3)*PI*r*r*r; printf(“Dien tich: %6.2f\n”, s); printf(“The tich la: %6.2f”, v); getch(); } Bình luận
#include <stdio.h>
#include <conio.h>
#include <math.h>
#define PI 3.14159
int main() {
int r;
float s, v;
printf (“Nhap ban kinh r: “);
scanf(“%d”, &r);
s = 4*PI*r*r;
v = (4/3)*PI*r*r*r;
printf(“Dien tich: %6.2f\n”, s);
printf(“The tich la: %6.2f”, v);
getch();
}