;

Senin, 17 September 2012

turbo c


1.
/* Contoh Program Menghitung Luas Lingkaran */
# include <>
main()
{
float l,r;
clrscr();
Printf ( " Menghitung Luas Lingkaran \n ");
Printf ( " =========================\n ");
Printf ( " Masukkan Nilai Jari - Jari : ");
scanf ( "%f",&r);
l=3.14*r*r;
printf (" Luas Lingkaran = % 6.2%f",l);
getch();
}
2.
/* Contoh Program Menghitung Luas Segitiga */
# include <>
main()
{
float L,a,t;


clrscr();
Printf ( " Menghitung Luas Segitiga \n ");
Printf ( " =========================\n ");
Printf ( " Masukkan Nilai alas : "); scanf ( "%f",&a);
Printf ( " Masukkan Nilai tinggi : "); scanf ( "%f",&t);
L = 0.5*a*t;
printf (" Luas Segitiga = % 6.2%f",L);
getch();
}
/* Contoh Program Menggunakan Fungsi */
# include <>
# include
main ()
{
hpslyr();
cw ( " contoh Program Fungsi ", GREEN);
cw ( " Press Any Key to Exit ", GREEN + BLINK);
getch();
}
hpslyr()
{
clrscr();
}
cw(teks,warna)
{
printf("\n");
textcolor(warna);
cprintf(text);
}
/* Menghitung Luas Lingkaran */
# include <>
#include
main()
{
float luaslink,j ;
wlyr (BLUE)
cw ("Menghitung Luas Lingkaran ");
cw ("Masukkan nilai r : ",YELLOW );
scanf(" % f ",& j);
luaslink=luaslink(j);
cprintf ( " Luas lingkaran = % .2f",luaslink);
cw ( " Press Any Key to Exit ", GREEN + BLINK);
getch();
}
wlyr(warna )
{
Textbackground(warna);
clrscr();
}
cw(teks,warna);
{
printf("\n");
textcolor(warna);
}luas link (r)
float r;
{
return (3.14*r*r);
}

Tidak ada komentar:

Poskan Komentar