write a program using Q Basic to find the area of a rectangle
Answers
Answered by
0
import java.util.*;
public class Radius_Area
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
float p,r,a;
System.out.println("Enter the perimeter");
p=in.nextFloat();
r=p*(7/22)*(1/2);
a=(22/7)*r*r;
System.out.println("The radius is"+r);
System.out.println("The area is"+a);}}
Answered by
0
Below are the Q-Basic program for the above question :
Output :
If the user enter 3 and 4, then the output is 12.
If the user enter 3 and 3, then the output is 9.
Explanation:
INPUT "Enter the value of a length to find the area of a Rectangle: ",Length 'Take the input from the user for length.
INPUT "Enter the value of a breadth to find the area of a Rectangle: ",Breadth 'Take the input from the user for breadth.
PRINT "The area of a rectangle is:",Length*Breadth,'Print the area of Rectangle.
Code Explanation :
- The first and the second line is used to take the input from the user.
- Then the area is printed by the help of print function and calculate the area by the help of area of a rectangle.
Learn More :
- Q-Basic : https://brainly.in/question/8054761
Similar questions