For Loop

This is a discussion on For Loop within the C++ Programming forums, part of the General Programming Boards category; I need to produce code that will print a table that shows the value of Pi by n (n from ...

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    3

    Exclamation For Loop

    I need to produce code that will print a table that shows the value of Pi by n (n from 1 to 10. I need to use a "for" loop. Can anyone assist?

    HELP!

  2. #2
    Registered User InFeStEd-ArCh0n's Avatar
    Join Date
    Apr 2002
    Posts
    63
    Code:
    for(int i=1; i<10; i++)
    {
    cout << "Pi by " << i << " = " << (i*3.14) << "\n";
    }
    That should be small and simple.
    -Mike
    {InFeStEd-ArCh0n}

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21