首页 > 其他分享 >Struct ForDemo03

Struct ForDemo03

时间:2023-10-22 13:03:22浏览次数:43  
标签:输出 Struct ForDemo03 System print out

package com.chen.struct;

public class ForDemo03 {
public static void main(String[] args) {
//练习2:用while或for循环输出1-1000之间能被5整除的数,并且每行输出3个
for (int i = 0; i < 100; i++) {
if (i%5==0){
System.out.print(i+"\t");
}
if (i%(3*5)==0){
System.out.println();
//System.out.print("\n");
}
}
//print输出不换行
//println输出换行

}
}

标签:输出,Struct,ForDemo03,System,print,out
From: https://www.cnblogs.com/jingyichenloveningning/p/17780300.html

相关文章

  • Struct
    packagecom.chen.struct;publicclassForDemo02{publicstaticvoidmain(String[]args){//练习一:计算0到100之间奇数和偶数的和intoddsum=0;intevensum=0;for(inti=0;i<100;i++){if(i%2!=0){//奇数......
  • Struct ForDemo01
    packagecom.chen.struct;importjava.util.Scanner;publicclassForDemo01{publicstaticvoidmain(String[]args){inta=1;//初始化条件while(a<100){//条件判断System.out.println(a);//循环体a+=2;//迭代}......
  • Struct ForDemo05
    packagecom.chen.struct;publicclassForDemo05{publicstaticvoidmain(String[]args){int[]numbers={10,20,30,40,50};for(inti=0;i<5;i++){System.out.println(numbers[i]);}System.out.println("=......
  • Struct ForDemo04
    packagecom.chen.struct;publicclassForDemo04{publicstaticvoidmain(String[]args){//打印九九乘法表//1.先打印第一列//2.把固定的1在用一个循环包起来//3.去掉重复项,i=j;//调整样式for(inti=1;i<=9;i......
  • Codeforces Round 865 (Div. 2) B. Grid Reconstruction
    给一个\(2\timesn\)的网格,且\(n\)是偶数。你需要将\(1\sim2\timesn\)填入这个网格。一条路径是从\((1,1)\)开始,每次只能向右或向下,到\((2,n)\)结束时,所经过的位置。按经过点的顺序标号,一两条路径的代价是\(cost=a_1-a_2+a_3-a_4+\cdots=\sum_{i=1......
  • CF1003E Tree Constructing
    很trivial的构造题首先上来判掉一些显然无解的情况,然后考虑既然最后直径长为\(d\)那么不妨先搞一条长度为\(d\)的链来考虑在链上接一些点使得直径不会变长,对于链上的某个点,它最多能接上的链的长度就是它到两个端点距离的最小值不妨设计递归函数求解,设solve(x,dis,lim)表示在\(x......
  • Struct IfDemo02
    packagecom.chen.struct;importjava.util.Scanner;publicclassIfDemo02{publicstaticvoidmain(String[]args){//考试分数大于60分就是及格,小于60分就是不及格。Scannerscanner=newScanner(System.in);System.out.println("请输入成......
  • Struct SwitchDemo01
    packagecom.chen.struct;importjava.util.Scanner;publicclassSwitchDemo01{publicstaticvoidmain(String[]args){//case穿透//switch匹配一个具体的值chargrade='C';switch(grade){case'A':......
  • Struct SequenceDemo01
    packagecom.chen.struct;publicclassSequenceDemo01{publicstaticvoidmain(String[]args){System.out.println("hello1");System.out.println("hello2");System.out.println("hello3");System.o......
  • Struct IfDemo03
    packagecom.chen.struct;importjava.util.Scanner;publicclassIfDemo03{publicstaticvoidmain(String[]args){//考试分数大于60分就是及格,小于60分就是不及格。Scannerscanner=newScanner(System.in);System.out.println("请输入成......