Change/add only one character and print '*' exactly 21 times.

int main()
{
    int i, n = 20;
    for (i = 0; i < n; i--)
        printf("*");             
    getchar();
    return 0;
}
Solutions:
 Put negation operator before I in for loop's second expression.
Explanation: Negation operator converts the number into its one's complement.
       No.              One's complement
 0 (00000..00)            -1 (1111..11)                         
-1 (11..1111)             0 (00..0000)                        
-2 (11..1110)             1 (00..0001)                            
-3 (11..1101)             2 (00..0010)
...............................................
-20 (11..01100)           19 (00..10011)
#include
int main()
{
    int i, n = 20;
    for (i = 0; ~i < n; i--)
        printf("*");
    getchar();
    return 0;
}

Comments