Write a C Program to find a Perimeter of Rectangle
Write a C Program to find a Perimeter of Rectangle
Here is the C Program to find the perimeter of rectangle using the formula 2(length + breadth) . Length and breadth is taken as input from user.
#include<stdio.h>
#include<conio.h>
int main()
{ int a,b;
printf(“Enter value of length & breadth of rectangle:”);
scanf(“%d %d”,&a,&b);
printf(“Perimeter of rectangle is:%d”,2*(a+b));
return 0;
}
OR
#include<stdio.h>
#include<conio.h>
int main()
{ int a,b;
printf(“Enter value of length & breath of rectangle:”);
scanf(“%d %d”,&a,&b);
int p;
p= 2*(a+b);
printf(“Perimeter of rectangle is:%d”,p)
return 0;
}
Output