Click the Follow Button

c : papersize

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, A2, … A8.

 #include <stdio.h>

int main ()
{
  int b, l, t;
  l = 1189;
  b = 841;
  t = 0;
 
  for (int i = 0; i < 9; i++)
    {
      printf("%d %d \n", l, b);
    t = l;
    l = b;
    b = t/2;
    }
 
}

Comments

Popular Posts

TIC - TAC - TOE

Prime and not prime number

do_while loop is to do something again and again