Question 2
Write a program to input length and width of a rectangle and output its perimeter
import java.util.Scanner; // scanner is in the java.util package
/**
* @(#)kiraperimeter.java
*
* kiraperimeter application
*
* @author
* @version 1.00 2013/1/30
*/
public class kiraperimeter {
public static void main(String[] args) {
int length; // variable declaration
int width;
int perimeter;
// TODO, add your application code
Scanner input = new Scanner(System.in); // create a scanner
//length=7;
length =input.nextInt();
//width=3;
width =input.nextInt();
perimeter = 2*(length+width);
System.out.println("Perimeter =" + perimeter);
}
//sini tak boleh
}
//sini tak boleh
Question 3
Write a program to input length and width of a rectangle and output its area. Start with pseudocode and flowchart.
Subscribe to:
Post Comments (Atom)
Cara download Installer windows 10 dalam format ISO
1. Jika anda bercadang untuk download windows 10 melalui website rasmi windows - pilihan untuk download dalam format ISO tidak di berikan. ...
-
ANSWERS TO CHAPTER EXERCISES (CHAPTER 8) Review Questions 1. List and describe various types of output, including technolog...
-
Based on real life scenario on any local company/ organization which you are very familiar, define the problem that could be addressed thr...
-
A. Response to the following statements by circling either T (TRUE) or F (FALSE). [10M] I. 1. Java enables users...
No comments:
Post a Comment