Advertisement
anonymzz

Untitled

Mar 11th, 2023
563
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.71 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. // start of the main function
  4. int main(void) {
  5.     // declaration variables
  6.     int length, width, perimeter, area;
  7.  
  8.     printf("Hello World\n"); // print somthing something
  9.  
  10.     printf("Enter width of rectangle : "); //display message
  11.     scanf("%d", &width); // scan and initialization to width
  12.  
  13.     printf("Enter length of rectangle : "); // display message
  14.     scanf("%d", &length); // scan and initialization to length
  15.  
  16.     // calculation
  17.     area = width * length;
  18.     perimeter = (width + length) * 2;
  19.  
  20.     printf("Perimeter of the rectangle = %d\n", perimeter); // display perimeter
  21.     printf("Area of the rectangle = %d", area); // display area
  22.  
  23.     return 0;
  24. } // end of main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement