76 402
Assignments Done
Successfully Done
In May 2019

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 */
printf("Enter breadth: ");
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 */
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!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions