Program to calculates the area of a rectangle

Here is the program to calculates the area of a rectangle,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "stdio.h"
#include "conio.h"
 
void main()
{
  int w,h;
  int area;
  printf("\nEnter the width of the rectangle ");
  scanf("%d",&w);
  printf("\nEnter the height of the rectangle ");
  scanf("%d",&h);
  area=w*h;
  printf("\nThe area of a rectangle is %d",area);
getch();
}

Output:

Enter the width of the rectangle 8
 
Enter the height of the rectangle 6
 
The area of a rectangle is 48

2 Responses to “Program to calculates the area of a rectangle”

  1. First, set up an equation for the area of the rtagcnele. If x is the width, then we havex(x + 4) = 221Note that if we put this into standard quadratic form and then try to factor, we wind up back where we started, in some sense: we are looking for two numbers that multiply to 221 and that differ by 4.x2 + 4x – 221 = 0Beyond pure trial and error, we can look for nearby squares. 221 is nearly 225, which equals 152. So we might try numbers near 15. As it turns out, 221 = 13 d7 17. We might even get there by noticing a difference of squares: 221 = 225 – 4 = 152 – 22 = (15 – 2)(15 + 2) = 13 d7 17. As a last resort, we could always use the quadratic formula, which gets us the roots of the equation as well.Now, the diagonal of the rtagcnele will be given by the Pythagorean Theorem:d2 = 132 + 172= 169 + 289= 458.The square root of 458 is definitely larger than 20, since 202 = 400. Going up, we can compute 212 = 441 458. So the length of the diagonal must be between 21 and 22.The correct answer is C.

    Reply
    • Coralee

      Moi je pense que c’est une source de débat inieatssrbla, mais je m’accorde a votre avis si proche du mien. Et je remarque aussi que vous lisez étonnement vite ! Je le savait mais c’est encore plus flagrant lorsque l’on voit défiler les titres de la tétralogie de Stephenie Meyer sur vos “lectures du moment”, il me tarde de lire votre avis sur le 3°

      Reply

Leave a Reply