1) Write a program to calculate the perimeter of a rectangle. Take sides, a & b, from the user.

     Answer:- C Programming code 

                                 -: CODE:-


//Write a program to calculate the perimeter of a rectangle 

#include<stdio.h>

int main()

{

    int a, b, perimeter;

    printf("enter the side of rectangle a:\n",a);

    scanf("%d",&a);

    printf("enter the side of rectangle b:\n",b);

    scanf("%d",&b);

    perimeter=2*(a+b);

    printf("perimeter of rectangle is : %d",perimeter);

    return(0);

}


Input and output :-





Comments