Subscribe Twitter FaceBook

Sabtu, 26 Juni 2010

Algorithm and Programming part 1

In this Occasion, I wanna share about Algorithm and Programming .  What is Algorithm ??? Algorithm is Sequence of command or Process .  Programming is a process to make program.  Okay,  In this case i'm gonna gonna share by using C language programming
Why do i choose C programming language ??? Because C is the oldest and the most famous programming language
Here is the requirements for good algorithm :
1.  Every step must be absolute
2.  At least 1 output
3.  Systematic
4.  Having term to stop process

This is a sample for 1st Program
#include
void main(){
  printf("hello world \n");
}

save by name hello.c
compile by using this command
#gcc hello.c -o hello
run by using this command
#./hello

This is a sample for 2nd Program


#include
const phi=3.14;
int main(){
int r;
float l,k;
printf("input ring finger :");scanf("%d", &r);
l=phi*r*r;
k=2*phi*r;
printf("circumference is : %2f \n", k);
printf("wide circle is      :%2f \n", l);
}
save by name circle.c

see you later on 2nd part

0 komentar:

Posting Komentar