Calculate the number of the first 10 that can be divisible by 3 but cannot be divisible by 7 within 100, and calculate all the prime numbers within 200.

Source: Internet
Author: User

Import java. util. arraylist;
Import java. util. List;

Public class song {

/**
* @ Param ARGs
*/
Public static void main (string [] ARGs ){
// Todo auto-generated method stub
/*
* 1. Calculate the first 10 divisible by 3 but not 7 within 100.
**/
Int COUNT = 0;
For (int A = 0; A <= 100; A ++)
{
If (a % 3 = 0 & A % 7! = 0)
{COUNT = count + 1;
System. Out. Print ("A =" + A + "\ t ");

If (COUNT = 10 ){

Break;
}
}
}
System. Out. println ();
/*
* 2. Calculate all prime numbers within 200
*
**/

For (INT q = 1; q <= 200; q ++ ){
For (INT u = 2; U <= Q; U ++)
{
If (Q % u = 0 & Q = u ){
System. Out. Print (U + "");

}
If (Q % u = 0 & Q! = U ){
Break;
}
}

}
System. Out. println ();


/*
* 4. Bring 123456789 back.
*
**/
Int [] A = {1, 2, 4, 5, 6, 7, 8, 9, 10 };
For (INT B = 0; B <A. length; B ++)
{
Int c = 10-b;
System. Out. Print (C + "\ t ");
}












/*
* 5 .*
***
*****
*******
*********
**/
For (INT I = 0; I <= 5; I ++ ){
For (Int J = 0; j <5-i; j ++ ){
System. Out. Print ("");

}

For (INT n = 1; n <= (I-1) * 2 + 1; n ++ ){
System. Out. Print ("*");
}
System. Out. println ();
}
}

}

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.