Paper of size A0 has dimensions 1189 mm x 841 mm. each subsequent size A(n) is defined as A(n-1) cut in half parallel to its shorter sides. Thus paper of size A1 would have dimensions 841 mm x 594 mm. write a program to calculate and print paper sizes A0,A1,.....A8.
// program to calculate the size of paper.
#include <stdio.h>
int main()
{
int w = 841, h = 1189, i, temp;
for (i = 0; i <= 8; i++)
{
printf("A%d:%dmm x %dmm\n", i, w, h);
temp = h;
h = w;
w = temp / 2;
}
return 0;
}
// output
A0:841mm x 1189mm
A1:594mm x 841mm
A2:420mm x 594mm
A3:297mm x 420mm
A4:210mm x 297mm
A5:148mm x 210mm
A6:105mm x 148mm
A7:74mm x 105mm
A8:52mm x 74mm
Comments
Post a Comment