Thread: What is wrong?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    7

    What is wrong?

    I need to fix each of these codes so that it will print numbers between 1 and 10. what is wrong?
    Code:
    #include <iostream>
    using namespace std;
    int main (void){
    for (int n=1; n<=10; n++);
    cout << n << endl;
    return 0;
    }
    and

    Code:
    #include <iostream>
    using namespace std;
    int main (void)
    { n=1;
    while (n<11)
    cout << n << endl;
    n++;
    return 0;
    }
    any help would be appreciated, thanks
    Last edited by girliegti; 09-18-2003 at 09:22 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 07-15-2004, 03:30 PM
  2. Debugging-Looking in the wrong places
    By JaWiB in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 11-03-2003, 10:50 PM
  3. Confused: What is wrong with void??
    By Machewy in forum C++ Programming
    Replies: 19
    Last Post: 04-15-2003, 12:40 PM
  4. God
    By datainjector in forum A Brief History of Cprogramming.com
    Replies: 746
    Last Post: 12-22-2002, 12:01 PM
  5. Whats wrong?
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 07-14-2002, 01:04 PM