java编程;根据键盘输入的圆柱体的半径和高求圆柱体的体积

2024-12-02 03:38:44
推荐回答(4个)
回答1:

2,class sum
{
public static void main(String argv[])
{
int s=0,j,x;
System.out.printf("输入一个四位数\n");
x = System.in.read();
while (x!=0)
{
j=x%10;
s=s+j;
x=x/10;
}
System.out.printf("四位数位数之和sum=%d\n",+s);
}
}

3,class jo
{
public static void main(String argv[])
{
int x;
System.out.printf("输入一个整数:\n");
x= System.in.read();
if (x%2==0)
System.out.printf("%d is oushu!\n",+x);
else
System.out.printf("%d is jishu!\n",+x);

}
}

1,
class tj
{
public static void main(String argv[])
{
double bj,gao;
System.out.printf("输入半径\n");
bj= System.in.read();
System.out.printf("输入高\n");
gao= System.in.read();
System.out.printf("圆柱体的体积为%f\n", bj*bj*3.1415926*gao);
}
}

回答2:

class ff
{
public static void main(String argv[])
{
double r,h;
System.out.printf("输入半径\n");
r = System.in.read();
System.out.printf("输入高\n");
h = System.in.read();
System.out.printf("圆柱体的体积为%f\n", r*r*3.1415926*h);
}
}

回答3:

class fff
{
public static void main(String argv[])
{
double r,h;
System.out.printf("输入半径\n");
r = System.in.read();
}
}

回答4:

import java.util.*;