Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

ton12

  • 3 years ago

Rewrite the following set of program segment using for loop int x, t = 0, s =0; x=2; do { s += x; y=0; do { t = t + s * y; y++; }while( y < x/2); cout<<t<<s; cout<<endl; x+ +; }while(x < 20 );

  • This Question is Closed
  1. ton12
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    @ajprincess @A.Avinash_Goutham

  2. A.Avinash_Goutham
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    the first for is smthin like for(x=0;x<20;x++) and i think u shud work on the second

  3. A.Avinash_Goutham
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    for(initialise ; bounds ; increment) any of those fields can be empty.... and when u have multiple initialisations u use a ' , ' and bound is a logical expression

  4. pandabodoh
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    int x, t = 0, s =0; x=2; for(x=0;x<20;) { s += x; y=0; for(y=0; y < x/2; y++;) { t = t + s * y; } cout<<t<<s; cout<<endl; x++; }

  5. A.Avinash_Goutham
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    humph u r close @pandabodoh

  6. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy