Computer Science, asked by Aryan9933, 1 year ago

write a program using variable to find the area and perimeter of a rectangle whose length is 10cm and breadth half of of length


kromapdm18j: In what language?

Answers

Answered by nitish8089
0
public class program{

public static void main(String...args){

double length=10;

double breadth=length/2;

double perimeter=2*(length+breadth);

System.out.println("perimeter of rectangle "+perimeter);

double area=length*breadth;

System.out.println("area of rectangle "+area);

}

}

_____________________c++

#include<iostream>

using namespace std;

int main(){

double length=10;

double breadth=length/2;

double perimeter=2*(length+breadth);

cout<<perimeter;

double area=length*breadth;

cout<<area;

return 0;

}

Aryan9933: bro in c++ it is not java
nitish8089: ok
nitish8089: c++ add on
nitish8089: :)
Similar questions