Monday, 30 October 2017

Introduction to Java program


Problem 1.9:
                   Write a program that displays the area and perimeter of a rectangle with the width of 4.5 and height of 7.9 using the following
Description
formula:
area = width * height
Solution:
          public class Message {

    public static void main(String[] args) {
          float heigth=7.9f,width=4.5f;
          System.out.println("The area of rectangle is  "+(heigth*width));
    } }


Output:




No comments:

Post a Comment