Subscribe Twitter FaceBook

Sabtu, 26 Juni 2010

Algorithm and Programming part 2

Algorithm in C has 3 main parts :
1.  Header
2.  Declaration
3.  Description

>>Header means library on C system that you want to use in creating program
>>Declaration means place where you can declare or define constanta , variable, function, & etc..
>>Description means place for main statements in program

here is sample for odd and even number


#include
int main()  //this is header
{
int a,b;  //this is declaration

//this below statements are description
printf("input a number :");scanf("%d", &a);
b=a%2;
if (b==0)
printf("the number is even \n");
else
printf("the number is odd \n");
}
save by name number.c

1 komentar:

Anonim mengatakan...

Thank's Bro...

Posting Komentar