Write a c++ program to input choice and print area of 1 or perimeter of 2
Answers
Answered by
0
{
public static void main(String[] args) {
int a, r;
double A, P;
Scanner in = new Scanner(System.in);
System.out.println("Enter radius of circle");
r = in.nextInt();
System.out.println("Enter '1' for area of circle and '2' for perimeter");
a = in.nextInt();
in.close();
switch(a){
case 1:
A=3.14*r*r;
System.out.println("The area of the cirlce is " + A + " square units.");
break;
case 2:
P=2*3.14*r;
System.out.println("The area of the cirlce is " + P + " units.");
break;
default:
System.out.println("Please enter either 1 or 2.");
break;
}
}
}
public static void main(String[] args) {
int a, r;
double A, P;
Scanner in = new Scanner(System.in);
System.out.println("Enter radius of circle");
r = in.nextInt();
System.out.println("Enter '1' for area of circle and '2' for perimeter");
a = in.nextInt();
in.close();
switch(a){
case 1:
A=3.14*r*r;
System.out.println("The area of the cirlce is " + A + " square units.");
break;
case 2:
P=2*3.14*r;
System.out.println("The area of the cirlce is " + P + " units.");
break;
default:
System.out.println("Please enter either 1 or 2.");
break;
}
}
}
Answered by
0
yg fwcv
gsywggwgwh
ahhahhahahahahqvwgececccscvennsn
ehhswhwhhwwhwhhwhggcgahjahahahauhayagaytaggagahhwhqw
hahahaha
jjjwjjyffffffffdddddddffddffffcfffffggGi it yung fb hunchback they
gsywggwgwh
ahhahhahahahahqvwgececccscvennsn
ehhswhwhhwwhwhhwhggcgahjahahahauhayagaytaggagahhwhqw
hahahaha
jjjwjjyffffffffdddddddffddffffcfffffggGi it yung fb hunchback they
Similar questions