Q1-Write a program to find the product of two numbers x and y,where x=120 and y=300. Q2- Create a program to calculate and print the circumference and area of a circle
Answers
Answered by
1
Q1 :
import java.util.*;
public class product
{
public static void main (String args[])
{
int x = 120 , y = 300;
System.out.print("Product of x and y : "+ x * y);
}
}
Q2 :
import java.util.Scanner;
public class Area_Circumfrence
{
public static void main(String[] args)
{
float r, area, circum;
Scanner sc = new Scanner(System.in);
System.out.print("Enter the Radius of Circle: ");
r = sc.nextFloat();
area = (float) (3.14*r*r);
circum = (float) (2*3.14*r);
System.out.println("\nArea = " +area);
System.out.println("Circumference = " +circum);
sc.close();
}
}
Similar questions