Hi… Hi. Hi.. Hello the IT knowledge (science) lovers.. you
are on my blog, in here to be found many IT knowledge from desktop programming
until web programming. Like as : Php, Html, MySQ, that is a web programming,
and for desktop programming like as : cobol, c, c++, visual basic, and other.
What do you find ? about program language C ? if yes, you
are was choice the right blog, because in this
article I want discuss about program language C. and I want giving you
sample simple program using language C with variable. You are ready ? so let’s
do read this article, have fun to read…
Previously you making the program language C you must having
the compiler program, like as : Borland C++ or Turbo C. you can using it.
Variables in C programming language is a value that are
changing - a fox for prooses execution continues. or value which would stop
changing when ekseskusi stop
Characters in the C programming language is that its value
remains, though in a state run program continued or repeated - constantly. or
character is a fixed rate until the execution is terminated
And this simple program, you can copy or write on notepad or
direct to the program :
Example 1 :
#include <stdio.h>
main()
{
int n, i;
long int factorial= 1;
printf ("Input factorial: ");
scanf ("%d", &n);
for (i = 2; i <= n; i++)
factorial= factorial* i;
printf ("%d factorial= %d", n, factorial);
scanf ("%d", &n);
}
Logic
#include <stdio.h>
>> for include file in folder “stdio.h>
main()
>> for starting the program
{
>> opening brace
int a,b;
>> declare variables a and b
long int factorial = 1;
>> declare a variable factorial equals 1
printf ("Please Input factorial your : ");
>> for print sentence “Please Input factorial your”
scanf ("%d", &a);
>> for input the factorial
for (b = 2; b <= a; b++)
>> looping
Factorial = factorial * b;
>> operator
printf ("%d factorial= %d", a, factorial);
>> print value
scanf ("%d", &a);
>> (optional) only to see the value that is not
straight out
}
>> closing braces
Ok.. just it…
See you laters
No comments:
Post a Comment