Java Loop Exercise: What are the prime numbers between 100~200?

Source: Internet
Author: User
What are the number of prime numbers between package practicego;/* * 1.100~200? */public class Cto {public static void main (string[] args) {for (int i=100; i<=200; i++) {int count = 0;for (int j=1; j< ; =i; J + +) {if (i%j = = 0) {count++;}} if (count = = 2) {System.out.println (i+ "is Prime");}}}

Operation Result:

101 is the prime number 103 is the prime number 107 is prime number 109 is prime number 113 is prime number 127 is prime number 131 is prime number 137 is number is a prime number 139 is prime number 149 is a prime number 151 is a number of is a number of is a prime number 157 is prime number 163 is a prime number 167, which is prime number 173 is prime 99 is prime number


Java Loop Exercise: What are the prime numbers between 100~200?

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.