On my previous posts have discussed several determinants formats are briefly described here and here
Further discussion will be explained in my post this time,
the example simple program that displays % o (octal displays an integer value) and % x (hexadecimal value displays integer).
* Displays Octal Value (% o)
# include
play ()(
int o;
printf ( "input decimal values?");
scanf ( "% d", & O);
printf ( "octal value =% o \ n", O))
results that look like the following:
input decimal value? 4567
octal value = 10,727
* Displays the hexadecimal value (% x)
# include
main ()
(
int A;
printf ( "input values?");
scanf ( "% d", & A)
printf ( "hexadeciaml value = % x \ n", A)
)
results:
input decimal value? 4567
hexadecimal value = 11d7
In the C programming language, we know there is a general library function is used to display the results of his prototype in stdio.h title file (the default input output header) as putchar (), puts () and printf ().
putchar and puts are the two function libraries that can be used to display the results did not preformatted. The point is the width and shape of the display can not be regulated. While printf () can be used to format the form of appearance. Then printf () can be used to display the result set format, because it can use the format code. Will discuss more about the code format (the format specifier), especially% d and% i.
%d and %i both have utility for displaying a decimal integer value. What distinguishes only coverage (range) decimal numbers only.
At this opportunity I will explain about defining formats and different from the% e,% f,% g.
% e function to display the real number in exponential notation, such as the following example;
# include
main ()
(
float A = 0.007654321
printf ( "% e \ n", A);
)
if the program is executed, the results:
7.654321e-003
% f function untukmenampilkan real numbers in the notation aaaa.aaaaaa, if you use a program like this:
# include
main ()(
float A = 0.007654321;
printf ( "% f \ n", A);)
then the output produced:
0.007654
% g function as substitutes% f or% e depends on the shortest.
example program:
# include
main ()(
float X1 = 345.6789;
float x2 = 98765432.1;
printf ( "% g% g \ n", X1, X2);)
the output after the program above was executed:
345,679 9.87654e +007
PARADIGM PROGRAMMING
Programming paradigm is a way of solving our view programming problems. There are many ways to solve a problem, so there are many existing paradigms.
Some examples of programming paradigm :
- Procedural
- Functional
- Structured
- Modular
- Oriented object
- Oriented function
- Declarative
- Sequence structure
- Input dan Output
- Operasi aritmatika
- Operasi pemindahan data dalam memori komputer
Dalam sequence structure tidak diperkenankan penggunaan kotak keputusan.
Pemrograman Deklaratif menggunakan paradigma bahwa dalam membuat program dimana pastinya terdapat masalah yang kompleks , sehingga membuat pemrograman ini mendeskripsikan suatu masalah tersebut dengan deklarasi fakta dan aturan. Berdasarkan fakta dan aturan yang disimpan dalam program, pemakai dapat melakukan query untuk mendapatkan jawaban yang merupakan komputasi dari program logik tersebut.Tentunya hal ini berbeda dengan cara menyelesaikan masalah dengan implementasi algoritma yang lebih spesifik dan detail dalam menjelaskan dan menyelesaikan permasalahan yang terdapat di program. Contoh bahasa pemrograman-nya antara lain : Prolog
Pemrograman berorientasi fungsi pada dasarnya menggunakan paradigma yang sangat sederhana , dimana pemrograman ini memfokuskan diri hanya dengan suatu fungsi tertentu saja yang sangat tergantung dari tujuan pembuatan bahasa pemrograman. seperti SQL (Structure Query Language) yang lebih menekankan kepada penggunaan database yang dapat dikoneksikan kedalam sebuah aplikasi berbasis web.HTML (Hyper Text Markup Language) serta XML (Extensible Markup Language) juga merupakan salah satu yang menggunakan paradigma ini.
Algoritma berisi urutan langkah-langkah penyelesaian masalah. Ini berarti Algoritma adalah proses yang procedural.
Definisi Prosedural menurut Kamus Besar Bahasa Indonesia :
- Tahap-tahap kegiatan untuk menyelesaikan suatu aktivitas.
- Metode langkah demi langkah secara eksak dalam memecahkan suatu masalah.
algoritma merupakan kumpulan perintah untuk menyelesaikan suatu masalah. Perintah-perintah ini dapat diterjemahkan secara bertahap dari awal hingga akhir. (wikipedia)
Oleh karena itu Algoritma setiap orang sangatlah berbeda satu dengan yang lain karena, pemikiran masing-masing orang dalam menyelesaikan suatu masalah sangatlah unique.