Computer Science, asked by adfrt, 1 year ago

Write a program to enter the sides of a rectangle and calculate its perimeter

Answers

Answered by Anonymous
4

import java.util.*;

public class Perimeter

{

public static void main(String args[])

{

Scanner in=new Scanner(System.in);

int a,b,p;

System.out.println("Enter the sides of the rectangle");

a=in.nextInt();

b=in.nextInt();

p=2*(a+b);

System.out.println("The perimeter of the rectangle is"+p);

}

}

Answered by Anonymous
3

#include ( studio.h)

#include (conio.h)

void main

{

int a,b,p=0;

printf("enter side of rectangle a and b");

scanf(%d%d,"&a,&b");

p = 2*a + 2*b ;

printf ("Enter perimeter");

Scanf( "%d,&p");

getch ( );

}

Similar questions