Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
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
Raw
Download
Tweet
HITS:
1019
Go to comments
Report
#include
<stdio.h>
int
main
()
{
int
side
;
int
area
;
int
perimeter
;
printf
(
"
\n
Please enter an integer for the side of a square : "
);
scanf_s
(
"%d"
,
&
side
);
area
=
side
*
side
;
perimeter
=
4
*
side
printf
(
"
\n
For a square with a side of %d, the area is %d, and the perimeter is %d."
,
side
,
area
,
perimeter
);
getchar
();
getchar
();
return
0
;
}
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus