In this program we will calculate the perimeter of rectangle by taking length , breadth  as an input        from user and displaying the result on the screen.
  If we go through the program given below we have taken input of length and breadth separately
  we can take any number of inputs in single  by writing a single printf() and scanf() function ,  which      we  will see in other programs listed..

  Program

  #include<stdio.h>

  #include<conio.h>

  int main()

 {

  int l , b , perimeter;

  printf("Enter the length of rectangle = ");

  scanf("%d",&l);

  printf("Enter the breadth of rectangle = ");

  scanf("%d",&b);

  perimeter = 2*( l + b);

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

  return 0;

 } 

 Output:


We have taken length and breadth as 8 and 9 and  got result Perimeter of rectangle as 34.

                     << Back

Post a Comment

Previous Post Next Post