As the for statement is particularly important in the c language, so today is the main learning content: Review for statements related knowledge, practice exercises (example) do not practice do not know, a practice surprised! ! !
And they will really understand, are two different things! & I will knock on is two different things! So we must learn programming language code that knock yourself, think for yourself, really knock themselves carrying a book to learn is - to master.
Man of few words said, began examples:
1-1:
a programming statement for seeking and 1 + 2 + 3 + ... + 100.
#include <stdio.h>
int main ()
{
int i,sum=0;
for(i=1;i<=100;i++)
sum=sum+i;
printf("sum=%d\n",sum);
}
1-2:
Programming inputs between 1--200 with all 3 in addition to more than 2, and the number with the addition of more than 53, and statistics such as the number of how many.
#include <stdio.h>
int main ()
{
int i,sum=0;
for(i=1;i<=200;i++)
if((i%3==2)&&(i%5==3))
{
printf("%4d",i);
sum++;
}
printf("\n这样的数有:%d个",sum);
}
1-3
again practice a little problem with cages of chickens and rabbits, or expose the problem.
Due to time reasons, today notes on finishing so much, thank you see here ~ see u tomorrow! good night!