(1)
public static void main(String[] args)
{
for (int i = 1; i <= 50; i++)
{
System.out.print(i);
if ((i %10=0)
System.out.println();
}
}
***************************************...
(2)
public static void main(String[] args) {
for (int i = 1; i <= 50; i++) {
System.out.print(i);
if ((i == 10) || (i == 20) || (i == 30) || (i == 40) || (i==50) {
System.out.println();
}
}
in (2) program i want to use loop or something else where (i==j),.where j contains values 10,20,30,40,50.
if(i==j){
System.out.println();
}
i want to do such because if i want to print from 1 to 100 then i have to type(i==10)(i==20)(i==30) .. till(i==100). so i want to use loop in if boolean statement if(i==j) where j can be a loop having values of j=j+10 i hope you understand my question.
Aucun commentaire:
Enregistrer un commentaire