Subscribe:

Ads 468x60px

Jumat, 10 Desember 2010

C LANGUAGE SYNTAX PROGRAM part I

PART I ==> simple calculator

# include <stdio.h>
# include <conio.h>
main ()
{
float x, y, add, less, times, for;
printf ("\ t PROGRAM CALCULATOR \ n");
printf ("Input number # 1:"); scanf ("% f", & x);
printf ("Input number # 2:");
scanf ("% f", & y);

added  = x + y;
less   = x-y;
time   = x * y;
for    = x / y;

printf ("\ n Results% .1 f +% .1 f =% .1 f", x, y, add);
printf ("\ n Results% .1 f -% .1 f =% .1 f", x, y, or less);
printf ("\ n Results% .1 f x% .1 f =% .1 f", x, y, time);
printf ("\ n Results% .1 f:% .1 f  =% .2 f", x, y, for);

printf ("\ n Results% .1 f% c =% .1 f \ n", x, 1, sqrt (x));
getch ();
}

Save with the extension. C


Display program 


CALCULATOR PROGRAM

Input number into-1  : 4
Input numbers into-2 : 5
Results 4.0 + 5.0  = 9.0
Results 4.0 - 5.0  = -1.0
Results 4.0 X 5.0  = 20.0
Results 4.0 : 5.0  = 0.80
Results
4.0 ☺      = 2.0 

Description of program:


The program above will perform simple arithmetic functions  on figures that have been fed. As already described in the previous tutorial, that the function of 'printf ()' which is to display the output to the screen and the function 'scanf ()' for reading the input data. Operators are in use in the above program is the addition operator (+), reduction (-), multiplication (x), division (:) and the square root ( smile ) hehehee,, sorry I have not met the square root ascii code. OK ..., it seems easy enough until here ... to deepen knowledge in C programming language, you can see in my next tutorial,, see you ....!  


Download as PDF

Rabu, 08 Desember 2010

HOW TO INSTALLING GCC COMPILER


         As already described in the previous tutorial, the compiler is the translator source code into machine language to be recognized by the computer.  One of the compiler that can be used is GCC, here I'll explain how to compiler GCC can be used well on your computer.
For windows 7 :
    1. Download file GCC compiler which is known by the name of MinGW.
    2. Then install into your PC .
    3. When the installation is placed on drive C: (not in program files)
ex : C:\MinGW Ex รจ C: \ MinGW
    1. Then right click on my computer ==> properties
    2. Select advanced
    3. In advenced dialog box, click the environment variables
    4. In the system variables, double click the path variables
    5. Type (C: \ MinGW \ bin), do not forget to add a semicolon (;) before the letter C
    6. Restart your PC 

       To use it: 
      1. Open a commend prompt 
      2. open the drive where you put the file C that you created.
      3. Type (gcc *****.c -o *****.exe)  
example : ( gcc calculator.c –o calculator.exe ) 
       4. Your program is ready for use.                     

 Note: (****) extention file name .c
download MinGW whitout  Installer here...

iws_niws_niws_wiws_eiws_siws_siws_c
iw_niw_niw_wiw_eiw_s0iw_s0iw_c

You can use dev c++ to compile

Rabu, 01 Desember 2010

PROGRAMMING C - STANDARD INPUT OUTPUT

In the programming c used the function "scanf ()" to read input in the insert, and fungis "printf ()" to display the results entered. Here is a list of formats for input.

Quote of the Day

if we plant the rice then it is definitely going to grow grass
but if we do not expect to plant grass to grow rice

if we do that then the world will follow hereafter
but if we do that the world then the afterlife will not participate

Followers