Selasa, Februari 11, 2014

Introduction To Printf() Function C Programming

Printf() function is function use on c programming to show one or more character on program result after be compiled and run. Printf actually is abbreviation of printfunction, it means function to print

The general form of this printf() function is:

printf("  ");

Character between quotation marks will be shown, e.g. we want to show misalnya kita ingin menampilkan Hello World character on program result, its steps as follows:

  1. Open Dev C++ program
  2. File menu > New > Source File, then will be created a worksheet named Untitled1
  3. On worksheet named Untitled1: File menu > Save As... > On save as type:, choose C source files (*.c) > on File name: for examplewe give name: Hello World.c > Click on Save
  4. First, write minimal syntax must exist on c programming, that is:

    main(){}

  5. Use getch function in main (){} function to show program result, so that program syntax be:

    main(){
           getch();
           }


  6. Add printf function to show character Hello World, make gecth() at end of progtam syntax, so that program syntax be:

    main(){
           printf("Hello World");
           getch();
           }


  7. Pelase compile and run, so that will shown program result as follow:
  8. Try change printf("Hello World"); position with getch(); position! so that program syntax be:

    main(){
           getch();
           printf("Hello World");
           }


    Hello World character will not shown directly, and will shown after input one character from keyboard, and program result will close immediately, please try...

Oke, that's all, hopefully useful... : )

Source:
http://belajar-tentangkomputer.blogspot.com

0 komentar: