Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Program untuk menghitung nilai absolut dari 2 variabel
- /* Programmer : William Handi Wijaya Tanggal diselesaikan : 21 November 2019
- NRP : 05111940000087 Kelas : Dasar Pemograman C */
- #include <stdio.h>
- #define M_PI 3.14159
- double getDouble(void);
- int main(void)
- {
- printf("-------------Surface Area of a Cone-------------\n\n\n\n");
- //Deklarasikan variabel - variabel yang digunakan
- double radius, //panjang jari - jari alas kerucut
- slant_height, //tinggi sisi miring kerucut
- surface_area; //luas permukaan dari benda
- //Masukkan data panjang radius alas kerucut
- printf("Please enter the circular base radius of the cone in cm => ");
- radius = getDouble();
- //Masukkan data tinggi sisi miring pada kerucut
- printf("Now, enter the slant height of the cone in cm => ");
- slant_height = getDouble();
- //Masukkan data ke dalam formula perhitungan luas permukaan kerucut
- surface_area = M_PI * radius * (radius + slant_height);
- //Tampilkan hasilnya pada layar monitor
- printf("The surface area of the cone is %f square centimeters\n\n", surface_area);
- return 0;
- }
- double getDouble(void)
- {
- double a;
- scanf("%lf", a);
- return a;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement