![]() ![]() With this article at OpenGenus, you must have the complete idea of how to calculate area and perimeter of a rectangle in C Programming Language. The value of the perimeter of the rectangle is 12 Press the Run button and correct any errors that occur. Table Python Program to find Area of a Rectangle - If we know the width and height. ![]() In the Code Editor, enter the program from Figure 1-7 that computes the area of a rectangle 2. In practice, the choice of a programming Learn Python Programming. Output enter the value of the length and breadth of the rectangle : Question: Programming Exercise 1.4 0 Instructions rectangle.py + 1 Put your code here N 3- LE Figure 1-7 Python script in an IDLE window I 1. Printf("the value of perimeter of rectangle is %d\n",peri) Printf("enter the value of length and breadth of the rectangle :\n") Implementation in Cįollowing is the complete C implementation to calculate the area and perimeter of a rectangle: // Part of iq. 0 denotes that the program has executed successfully. This Python area of rectangle program allows the user to enter the width and height of a rectangle. 2f' Perimeter) Python Program to find Area of a Rectangle using functions. 2f' Area) print(' Perimeter of Rectangle is. Printf("The value of perimeter of rectangle is %d\n",peri) Īt last, we are going to end the coding of the return 0 command. Following print statements will help us to print the Perimeter and Area of a rectangle. To find the value of area and perimeter, first we have to write the formula of area and perimeter and then print the value of it: area=l*b To find the area and perimeter of the rectangle.The variable used here are:įrom the above question, we got to know that we will put the length and breadth as user input so for this we will use: printf("Enter the value of length and breadth of the rectangle :\n") Here we have to use the variables to store the data. integers(int): for integer type numbers.double(double): for decimal type numbers. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |