-
Language
C
-
Description
It calculates tha area and the perimeter of a rectangle getting the height and the width.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>
#include <stdlib.h>
int main (void)
{
float area, height, perimeter, width;
printf ("Enter the value of height: ");
scanf ("%f", &height);
(void) getchar ();
printf ("Enter the value of width: ");
scanf ("%f", &width);
(void) getchar ();
area=height*width;
perimeter=height*2+width*2;
printf ("Value of area: %g\n", area);
printf ("Value of perimeter: %g\n", perimeter);
putchar ('\n');
system ("pause");
return EXIT_SUCCESS;
}
#include <stdlib.h>
int main (void)
{
float area, height, perimeter, width;
printf ("Enter the value of height: ");
scanf ("%f", &height);
(void) getchar ();
printf ("Enter the value of width: ");
scanf ("%f", &width);
(void) getchar ();
area=height*width;
perimeter=height*2+width*2;
printf ("Value of area: %g\n", area);
printf ("Value of perimeter: %g\n", perimeter);
putchar ('\n');
system ("pause");
return EXIT_SUCCESS;
}