Diktat_ProgKecilBhsC

# H int main kamus int i long int ii program printf

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: SIGNi.C */ /* Assignement dan print */ #include <limits.h> int main () { /* Kamus */ int i; long int ii; /* Program */ printf ("hello\n"); i = 1234; ii = 123456; printf ("Ini nilai i=1234 = : %d \n", i); printf ("Ini nilai ii=123456 : : %10d \n", ii); /* print nilai batas integer */ printf (“Min dan Max integer : %d, %d \n”, INT_MIN, INT_MAX); printf (“Max long integer : %ld, %ld \n”, LONG_MAX); return 0; } /* /* /* /* */ /* File : asign2.c */ Deskripsi : Program ini berisi contoh sederhana untuk mendefinisikan variabel-variabel bilangan bulat (short int, int, long int), karakter, bilangan riil, */ */ */ /*------------------------------------------------------------------*/ int main () { /* KAMUS */ short ks = 1; int ki = 1; long kl = 10000; char c = 65; /* inisialisasi karakter dengan integer */ char c1 = 'Z'; /* inisialisasi karakter dengan karakter */ float x = 1.55; /* Algoritma */ /* penulisan karakter sebagai karakter */ printf ("Karakter = %c\n", c); printf ("Karakter = %c\n", c1); /* penulisan karakter sebagai integer */ printf ("Karakter = %d\n", c); printf ("Karakter = %d\n", c1); printf printf printf printf return } ("Bilangan integer (short) = %d\n", ks); ("\t\t(int) = %d\n", ki); ("\t\t(long) = %ld\n", kl); /* perhatikan format %ld */ ("Bilangan Real = %f8.3\n", x); 0; OPERATOR & EKSPRESI /* File : incr.c */ /* Effek dari operator ++ */ int main () { /* Kamus */ int i, j; /* Program */ i = 3; j = i++; printf ("Nilai i : %d\nNilai j : %d\n", ++i, j); return 0; } /* File : oper1.c */ /* pemakaian beberapa operator terhadap bit */ int main () { /* KAMUS */ int n = 10; /* 1010 */ int x = 1; /* 1 */ int y = 2; /* 10 */ /* ALGORITMA */ printf ("n = %d \n", n); printf ("x = %d \n", x); printf ("y = %d \n", y); printf ("n & 8 = %d \n", n & 8); /* 1010 AND 1000 */ printf ("x & ~ 8 = %d \n", x &a...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online