Thread: Urgent!pls help me with this question be4 Thursday~

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    1

    Unhappy Urgent!pls help me with this question be4 Thursday~

    Please help me as i am a noob in c programming.
    Write a program that keeps printing the multiples of the integer 2, namely 2, 4, 8, 16, 32, 64, etc. Your loop should not
    terminate (i.e., you should create an infinite loop). What happens when you run this program?

    p/s : pls help me write the coments too, thanks!!

  2. #2
    Registered User
    Join Date
    Jul 2005
    Posts
    56
    i would use a while loop for an infinite loop.
    Code:
    while(1){.....}
    You can also use a for loop
    Code:
    for(;;){.....}
    Last edited by NewGuy100; 08-15-2005 at 12:58 PM.

  3. #3
    Registered User cbastard's Avatar
    Join Date
    Jul 2005
    Location
    India
    Posts
    167
    Code:
    long double i=1;
    while(1)
    { 
      i=i*2;
     printf("%ld",i);
    }
    dont expect anybody to do your homework here .this was done because it was too small to consider as Hw.
    It will run infinitely.you have to stop this prog with ctrl+break.This type of loop should not be there in programmin
    Last edited by cbastard; 08-15-2005 at 01:06 PM.

  4. #4
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Quote Originally Posted by cbastard
    this was done because it was too small to consider as Hw
    You always find some new way to show everyone here just how much of an idiot you really are.


    Quzah.
    Hope is the first step on the road to disappointment.

  5. #5
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    Quote Originally Posted by cbastard
    this was done because it was too small to consider as Hw.
    I believe the topic and the way the question was phrased somewhat implies that this counts as homework. If the OP couldn't even do this simple task him/herself, then they are already in trouble, and you helping them out is doing more harm than good.

  6. #6
    Registered User cbastard's Avatar
    Join Date
    Jul 2005
    Location
    India
    Posts
    167
    Quote Originally Posted by jverkoey
    I believe the topic and the way the question was phrased somewhat implies that this counts as homework. If the OP couldn't even do this simple task him/herself, then they are already in trouble, and you helping them out is doing more harm than good.
    sorry my mistake.I just did it caz it was one liner.sorry again.thanks for realizing me.I dont mind your things quzah.You just need to grow up .jokes apart,thank you too for pointing out my error

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    shing, the world doesn't owe you a thing
    Heh, poetry.

    Now read the link in my sig, and come back when you've made a real effort - there's days to go, so put some effort in.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  8. #8
    Banned
    Join Date
    Jun 2005
    Posts
    594
    Quote Originally Posted by cbastard
    sorry my mistake.I just did it caz it was one liner.sorry again.thanks for realizing me.I dont mind your things quzah.You just need to grow up .jokes apart,thank you too for pointing out my error

    i wouldnt have appoligized
    the board seems to hate those of us
    who destroy the world form the inside through
    the use of unwanted tactics of death and destruction
    desquized as help.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Alice....
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 06-20-2005, 02:51 PM
  2. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  3. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. Math Question, hard
    By Yoshi in forum A Brief History of Cprogramming.com
    Replies: 34
    Last Post: 12-08-2001, 11:58 AM