Tiger6117

Area and Perimeter of the Rectangle

Dec 2nd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2. /* height and width of a rectangle in inches */
  3. int width;          
  4. int height;        
  5.  
  6. int area;          
  7. int perimeter;      
  8.  
  9. int main() {
  10.     height = 7;
  11.     width = 5;
  12.  
  13.     perimeter = 2*(height + width);
  14.     printf("Perimeter of the rectangle = %d inches\n", perimeter);
  15.    
  16.     area = height * width;
  17.     printf("Area of the rectangle = %d square inches\n", area);
  18.  
  19. return(0);
  20. }
Add Comment
Please, Sign In to add comment