C Program: Input side of a square and print out its area and perimeter


SUBMITTED BY: Guest

DATE: Oct. 22, 2013, 3:25 p.m.

FORMAT: C++

SIZE: 467 Bytes

HITS: 1026

  1. #include <stdio.h>
  2. int main()
  3. {
  4. int side;
  5. int area;
  6. int perimeter;
  7. printf("\n Please enter an integer for the side of a square : ");
  8. scanf_s("%d", &side);
  9. area = side * side;
  10. perimeter = 4 * side
  11. printf("\n For a square with a side of %d, the area is %d, and the perimeter is %d.", side, area, perimeter);
  12. getchar();
  13. getchar();
  14. return 0;
  15. }

comments powered by Disqus