Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Write the factorial of 1 to 10 in C language.
Write the factorial of 1 to 10 in C language.
# include & ltstdio.h & gt

int main()

{

int a= 1,I; ?

for(I = 1; I<= 10; i++)

a = a * I; ?

Printf (factorial of "10 =%d", a);

Returns 0;

}

Extended data:

In C language, there are three types of loop statements: for statement, while statement and do While statement. They are described as follows:

for

For is an appropriate circular statement, which well reflects three problems that should be paid attention to in correctly expressing the circular structure:

(1) control variable initialization.

(2) circulation conditions.

(3) Update of loop control variables.

Meanwhile:

While structure loop is a when type loop, which is generally used when the number of loops is unknown. What keeps the loop is a conditional expression. If the condition holds, the loop body will be executed; if the condition does not, the loop will exit.

While statement format is:

While (conditional expression)

Circulating body

Conditional expressions should be judged before each execution of the loop body.

Baidu Encyclopedia-Circular Sentences