Kod sumber: Bab 2

[su_expand more_text=”Show code” less_text=”Hide code” height=”30″]1) Atur cara 2.1

#include <stdio.h>
int main()
{
printf("Atur Cara C Pertama Saya");
return 0;
}
[/su_expand]

[su_expand more_text=”Show code” less_text=”Hide code” height=”30″]2) Atur cara 2.2

#include <stdio.h>
int main()
{
int umur;
umur=20;
printf("Atur Cara C Pertama Saya\n");
printf("Selepas umur saya %d tahun",umur);
return 0;
}
[/su_expand]

[su_expand more_text=”Show code” less_text=”Hide code” height=”30″]3) Atur cara 2.3

#include <stdio.h>
int main (){
int umur; umur=20;
printf("Umur saya %d tahun", umur);
return 0; }
[/su_expand]

[su_expand more_text=”Show code” less_text=”Hide code” height=”30″]4) Atur cara 2.4

#include <stdio.h>
int main (){ int
umur;
umur
=20;
printf(
"Umur saya %d tahun",
umur);
return 0;
}
[/su_expand]

[su_expand more_text=”Show code” less_text=”Hide code” height=”30″]5) Atur cara 2.5

#include <stdio.h>
int main () {
int umur;
umur = 20;
printf("Umur saya %d tahun", umur);
return 0;
}
[/su_expand]

[su_expand more_text=”Show code” less_text=”Hide code” height=”30″]6) Atur cara 2.6

#include <stdio.h>
int main ()
{
int umur;
umur = 20;
printf("Umur saya %d tahun", umur);
return 0;
}
[/su_expand]

[su_expand more_text=”Show code” less_text=”Hide code” height=”30″]7) Atur cara 2.7

#include <stdio.h>
int main () {
char beep, gred = 0x41;
beep = 007;
printf("%c%c", gred, beep);
return 0;
}
[/su_expand]

[su_expand more_text=”Show code” less_text=”Hide code” height=”30″]8) Atur cara 2.8

#include <stdio.h>
int main () {
const float pi = 3.1415;
int panjang, lebar, luas_segi4;
float jejari, luas_bulatan;
panjang = 12;
jejari = 3.5;
lebar = 3;
luas_segi4 = panjang * lebar;
luas_bulatan = pi * jejari * jejari;
printf("Luas bulatan = %f \t\'Luas segi4 = %d\n",
luas_bulatan, luas_segi4 );
return 0;
}
[/su_expand]

[su_expand more_text=”Show code” less_text=”Hide code” height=”30″]9) Rajah 2.3

#include <stdio.h>
int main()
{
printf("Atur Cara C Pertama Saya");
return 0;
}
[/su_expand]

<<Back