C Loops - Programming - HWzone Forums
adplus-dvertising
Skip to content
  • Create an account
  • About Us

    Hello Guest!

     
    Please note - in order to participate in our community, comment and open new discussions, you must join as a registered member.

    Our members enjoy many advantages, including the ability to participate in discussions, enjoy raffles and promotions for members of the site, and receive our weekly content directly by email.

    Do not like being harassed by email? You can register for the site but do not submit your registration to the weekly email updates.

C Loops


The-Magician

Recommended Posts

One option is that the index of the loop will be d and each iteration will increase by d.

A second option is that in each iteration, you print a and another function of d that depends on i.

The first option is somewhat crooked because the condition for stopping the loop is awkward and less obvious.

Link to content
Share on other sites

Wai What a complicated trick I can not

I do not understand how I'm supposed to write it

That's what I think, but it's not true. Maybe tell me where my problem is?

#include

#include

void main ()

{

int n, i, d;

printf ("enter num: \ n");

scanf ("% d", & n);

if (n> = 5)

{

for (i = n; i <= (d * 9); i ++)

printf ("% d \ n", i);

}

else

printf ("error");

getch ();

}

Link to content
Share on other sites

A. The lecturer teaches a very old standard. Where do you study?

B. Will realize the second option I suggested. The loop should run 10 times and each time you print a + d, a + d + d, a + d + d + d and so on.

Think what the abbreviation of d + d + d + ... + d and how it relates to the index of the loop.

Link to content
Share on other sites

ארכיון

This discussion has been archived and new comments can not be added.

  • Latest news

  • Buzz-Zone: Everything hot on the net

×
  • Create new ...

At the top of the news:

new on the site