Professional Documents
Culture Documents
ASSIGNMENT SOLUTION
A. //Program to calculate the perimeter of a triangle
Import java.util.Scanner;
public class Perimeter
{
public static void main (String[]args)
{
int a, b, c;
Scanner s = new Scanner(System.in);
System.out.print("Enter the value of the first side:");
a = s.nextInt();
System.out.print("Enter the value of the second side:");
b = s.nextInt();
System.out.print("Enter the value of the third side:");
c = s.nextInt();
OUTPUT
Microsoft Windows [Version 10.0.19044.2006]
(c) Microsoft Corporation. All rights reserved.
C:\Users\DADA>cd Desktop
C:\Users\DADA\Desktop>cd Cosc Assignment
C:\Users\DADA\Desktop\Cosc Assignment>javac Weight.java
C:\Users\DADA\Desktop\Cosc Assignment>java Weight
Enter the value for diameter: 10
Enter the value for thickness: 6
The volume is: 78.55
Enter the value for density: 120
The weight of the sphere is: 9426.0