Length and Breadth question

+1 vote
asked Oct 9 by Akshay Kishore (140 points)

Paper of size A0 has dimensions 1189 mm * 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 * 594 mm. Write a program to calculate and print paper sizes A0, A1, A2, A3, ....... , A8

2 Answers

0 votes
answered Oct 9 by Peter Minarik (9,990 points)
This looks like an assignment to me.

Maybe give it your best shot first. Share your code and ask for help if you're stuck.

It's also a good idea to tell what language you need to use.
0 votes
answered Oct 12 by Ron McCloskey (220 points)
Start with something simple like:

cout << 'A'<<size<<'\t'<<length<<'\t'<<width<<endl;

get this working for A0 and then work on adding a loop around it  for A0 to A8

for the loop:

***longest side is always halved

***check to see if length is still larger than width, otherwise switch them

example run:

A0 1189  841

A1  841   594

A2  594   420

A3  420   297

A4  297   210

A5  210   148

A6  148   105

A7  105     74

A8    74     52
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.