Thread: For loop

  1. #1
    Banned
    Join Date
    Apr 2015
    Posts
    596

    For loop

    Hi guys, I've understood how loop for is working but still a lil confused .. I've done those two for loops
    Code:
    for (int i=1; i<n;i*=2)
    {}
    for (int i=n; i>n;i/=2)
    {}
    the two loops having the same number of iterations, is that accidentally?! if not, then please may you explain to me why is it the same? I'm frankly not good very much at math!


    thanks

  2. #2
    Informer -Adrian's Avatar
    Join Date
    Jan 2013
    Posts
    817
    I think that regardless of the underlying situation, he can benefit from nobody playing along anymore. If he's developmentally challenged, then this is a lesson he has to learn at some point. If he's a troll (crazy, if true), he'll benefit from having to find another outlet.

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    27,260
    Quote Originally Posted by RyanC
    as u aware of I'm very good at C programming
    Since you are very good at C programming, you should be able to write a C program to help you experiment and understand the pattern even without a strong maths background.

    So this is too easy for you.

    *closed*
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 09-22-2016, 09:08 AM
  2. Replies: 1
    Last Post: 03-28-2015, 08:59 PM
  3. Help - Collect data from Switch loop inside While loop
    By James King in forum C Programming
    Replies: 15
    Last Post: 12-02-2012, 10:17 AM
  4. Replies: 23
    Last Post: 04-05-2011, 03:40 PM
  5. for loop ignoring scanf inside loop
    By xIcyx in forum C Programming
    Replies: 2
    Last Post: 04-17-2007, 01:46 AM

Tags for this Thread