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

-
Latihan MS Word dengan elemen-elemen:- image, word art, table, shape dan word formatting (font,size,bold, italic,underline)
-
1.TOPUP Cepat Susut Jika anda merasa topup prepaid anda cepat susut walaupun tak banyak call- ada baiknya anda semak log call/sms/content ...
-
Contoh soalan untuk test 1 adalah seperti berikut (soalan dan 'marking' bagi semester sebelum ini)
No comments:
Post a Comment