Write in C to print out the prime number between 100~200.

Source: Internet
Author: User

To run the code:

#include <stdio.h>

#include <math.h>

int main ()

{

int A;

int b;

int n=0;

for (a=100;a<=200;a++)

{

for (b=2;b<=a-1;b++)

{

if (a%b==0)

Break If a can be divisible by B, then a break operation is performed, that is, do not perform the following if Operation return//above the For loop.

if (b==a-1)

{

printf ("%d", a);

n=n+1;

printf ("Number of%d prime numbers \ n", n.);

}

}

}

return 0;

}


Here is the result of the run:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/73/7B/wKioL1X_h2_TgvkLAAFIYUejIxc389.jpg "title=" QQ picture 20150921121602.png "alt=" Wkiol1x_h2_tgvklaafiyuejixc389.jpg "/>


This article is from the "Rookie Notes" blog, please be sure to keep this source http://10738432.blog.51cto.com/10728432/1696709

The

Writes the prime number between 100~200 in the C language.

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.