63 215
Assignments Done
99,3%
Successfully Done
In July 2018

Answer to Question #43451 in C++ for vishal raj

Question #43451
To enter length and breadth of rectangle and display area, perimeter and diagonal
Expert's answer
/* Answer on Question#43451- Subject - Programming, C++ */
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()  /* main function*/
{
int l,b,p; /* length, breadth, perimeter */
double d;  /* diagonal */
printf("Enter length: ");  /* user's input */
scanf("%d",&l);
printf("Enter breadth: ");
scanf("%d",&b);
d = sqrt(pow(l,2) + pow(b,2)); /* calculate diagonal using Pifagor theorem */
p = l*2 + b*2; /* perimeter */
printf("Perimetr: %d, Diagonal: %f\n", p, d); /* prints perimeter and diagonal */
system("pause");
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions