Hash Fellow robcat2075 Posted January 22 Hash Fellow Posted January 22 A programming guru tests your eye for bugs in C. Bonus: Can you spot HIS mistake? Quote
threedslider Posted March 1 Posted March 1 Maybe it is fixed from this ? #include <stdio.h> int sum = 0; int num = 0; int main() { for (int num = 0; num < 5; sum = num++) { sum = sum + sum; } printf("%d\n", sum); return 0; } Quote
threedslider Posted March 1 Posted March 1 But better maybe he means that to fix : #include <stdio.h> int sum = 0; int num = 0; int main() { for (int num=0; num < 5; num++) { sum += (num+2)/2; } printf("%d\n", sum); return 0; } Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.