keyboard
package aaa;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class Untitled1 {
public static void main(String[] args)throws IOException
{
BufferedReader keyboard= new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the number of podas followed by");
int numberOfPods=Integer.parseInt(keyboard.readLine());
System.out.println("the number of peas in a pod:");
int peasPerPod =Integer.parseInt(keyboard.readLine());
int totalNumberOfPeas =numberOfPods*peasPerPod;
System.out.println(numberOfPods+"pods and");
System.out.println(peasPerPod+"peas per pod.");
System.out.println("the total number of peas="+ totalNumberOfPeas);
}
}
程式結果

0 Comments:
发表评论
<< Home