Selamat Datang

Rabu, 11 November 2015

Kumpulan Contoh Coding C++ ( e

Voulme Bola

Kode Program :

#include<stdio.h>
#include<cstdlib>

using namespace std;
int main(int argc, char *argv[])
{
            float Pi=3.14, r, volume;
           
            printf("==============================\n");
            printf("   Menghitung Volume Bola\n");
            printf("==============================\n");
            printf("\n");
            printf("Masukan Nilai Jari-jari            = ");scanf("%f", &r);
            volume=4*Pi*r*r*r/3;
            printf("\n");
            printf("Volume Bola adalah    = %f\n", volume);
}

 



a.       Luas Balok

Kode Program :

#include<stdio.h>

int main()
{
      int p,l,t;
      printf("==============================\n");
      printf("    Menghitung Luas Balok\n");
      printf("==============================\n");
      printf("\n");
      float L;
      printf("Panjang balok : ");
      scanf("%d",&p);
      printf("Lebar balok   : ");
      scanf("%d",&l);
      printf("Tinggi balok  : ");
      scanf("%d",&t);
      L=2*(p*l+p*t+l*t);
      printf("\nHasil Luas Balok   = %0.0f \n",L);
}

Hasil Program :