‘C’ program to calculate area and perimeter of a rectangle.

C File =>


/* Write a ‘C’ program to calculate area and perimeter  of a rectangle. */

#include<stdio.h>
int main() 
{
    int l,b,a,p;
    printf("\n Enter length and bredth of rectangle : ");
    scanf("%d%d",&l,&b);
    a=l*b;
    p=2*(l+b);
    printf("\n Area of rectangle = %d",a);
    printf("\n Perimeter of rerectangle = %d",p);
 return 0;
}

Comments

Popular posts from this blog

Write a program to allocate memory dynamically for n integers. Accept the elements and calculate their sum and average

C program to accept names of n cities and search for city named “Pune”.