Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Venkat

    Question

    Hi All,

    I have the following problem please help me in solving this.

    #include <stdafx>
    main()
    {
    int i, n=20;
    for(i=0;i<n; i--)
    {
    printf(i);
    }

    Only one character in the above needs to be modified such that the character
    '-' will be printed 20 times.
    People say there are 3 ways of doing it but i could figure out only one way
    given below.

    #include <stdafx>
    main()
    {
    int i, n=20;
    for(i=0;i<n; n--)
    {
    printf(i);
    }

    Can someone crack the other 2 possibilities.


    regards,
    Venkat



Working...