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
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;
}
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;
}
Similar questions