Java Assignment1 Solutions
Java Assignment1 Solutions
import java.util.Scanner;
int a = sc.nextInt();
int b = sc.nextInt();
// Sample Output:
// Addition: 15
// Subtraction: 5
// Multiplication: 50
// Division: 2
import java.util.Scanner;
if (num % 2 == 0)
else
// Sample Output:
// Enter a number: 7
// 7 is Odd.
3. Write a JAVA program to find the perimeter and area of different geometrical figures.
import java.util.Scanner;
// Rectangle
double l = sc.nextDouble();
double b = sc.nextDouble();
// Circle
double r = sc.nextDouble();
// Triangle
System.out.print("Enter base and height of triangle: ");
double a = sc.nextDouble();
double b1 = sc.nextDouble();
double c = sc.nextDouble();
// Sample Output: