1/29/2013

BCS1243 PP -LAB 30 JAN 13

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.

No comments:

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.  ...