Facebook

adsense

Saturday, 28 February 2015

CALCULATE AREA AND PERIMETER USING C CODE

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
  int a,b,area,perimeter;

  printf("TO FIND THE AREA AND PERIMETER OF A RECTANGLE\nENTER THE LENGHT AND WIDTH OF A RECTANGLE\n");
  printf("LENTH\t\t");
  scanf("%d",&a);
  printf("WIDTH\t\t");
  scanf("%d",&b);

  area=a*b;
  printf("AREA \t\t=  %d",area);

  perimeter=2*(a+b);
  printf("\nPERIMETER\t=  %d\n\n\n\n",perimeter);
  system("PAUSE");
  return 0;
}

No comments:

Post a Comment