0 Fundamentals of C-language cycle

Source: Internet
Author: User

Record every day of learning, from zero to one. Stick with you and me.

Read a lot of books, still not programmed, from entering a pit in to another pit. In fact, very helpless, but there is no way.

Perhaps, you need a good thought process. Time will only let us remember those unforgettable things. Those who are gone, will never be remembered.

For example, to do a 5 factorial, you should think of the idea of recycling to solve.

There are three types of loops, each using

#include <stdio.h>//do 5 factorial.
int main ()
{
int i=1,sum=1;
while (i<=5) {
Sum=sum*i;
i++;
//}
do{
Sum=sum*i;
i++;
}while (i<=5);
for (i=1;i<=5;i++)
{
Sum=sum*i;
}
printf ("sum=%d", sum);
return 0;
}

The reference picture is visible in the album.

0 Fundamentals of C-language cycle

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.