package work2;
public class Dwork1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
for(int i=1;i<=4;i++)
{
for(int j=1;j<=7-2*(i-1);j++)
{
System.out.print("*");
}
System.out.println();
}
}
}
package work2;
import java.util.Scanner;
public class Dwork2 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int []a=new int[10];
int max=0;
Scanner sc=new Scanner(System.in);
System.out.println("请输入10个数字");
for(int i=0;i<a.length;i++)
{
a[i]=sc.nextInt();
max=a[0];
for(int b=0;b<a.length;b++)
{
if(a[i]>max)
{
max=a[i];
}
}
}
System.out.println("最大的娃娃对应的数字为:"+max);
}
}
package work2;
import java.util.Scanner;
public class Dwork3 {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("请输入一个正数:");
Scanner sc=new Scanner(System.in);
int number=sc.nextInt();
int s=fun(number);
System.out.println("该数字的个数位的乘积为:"+s);
}
public static int fun(int n)
{
int result=1;
while(n>0) {
result*=n%10;
n=n/10;
}
return result;
}
}