DO it in C

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Anoopnegi
    New Member
    • May 2007
    • 7

    #1

    DO it in C

    hey... i have to print 1 to 100 number without declaring any variable n using semicolon only once...so..how can u do this...
  • ilikepython
    Recognized Expert Contributor
    • Feb 2007
    • 844

    #2
    Originally posted by Anoopnegi
    hey... i have to print 1 to 100 number without declaring any variable n using semicolon only once...so..how can u do this...
    [code=cpp]
    #include <iostream>

    using namespace std;

    int main()
    {
    cout << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12 etc... ;

    return 0;
    }
    [/code]
    Also, please read the posting guidelines.

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Originally posted by Anoopnegi
      hey... i have to print 1 to 100 number without declaring any variable n using semicolon only once...so..how can u do this...
      Of course your question has nothing to do with serious software development.
      Better try at the IOCCC for that type of fun.

      kind regards,

      Jos

      Comment

      • Banfa
        Recognized Expert Expert
        • Feb 2006
        • 9067

        #4
        Strictly speaking ilikepython that is C++ not C

        Comment

        • JosAH
          Recognized Expert MVP
          • Mar 2007
          • 11453

          #5
          Originally posted by ilikepython
          [code=cpp]
          #include <iostream>

          using namespace std;

          int main()
          {
          cout << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8 << 9 << 10 << 11 << 12 etc... ;

          return 0;
          }
          [/code]
          Also, please read the posting guidelines.
          That's not C.

          kind regards,

          Jos ;-)

          Comment

          • ilikepython
            Recognized Expert Contributor
            • Feb 2007
            • 844

            #6
            Originally posted by JosAH
            That's not C.

            kind regards,

            Jos ;-)
            Well, come on, convertng it to C shouldn't be too hard. ;)

            Comment

            Working...