Question #43451
To enter length and breadth of rectangle and display area, perimeter and diagonal
1
Expert's answer
2014-06-20T09:26:43-0400
/* 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 the first!
LATEST TUTORIALS
APPROVED BY CLIENTS