Hello everyone.
I have just started to C programming. I wrote some codes with if, else if, else and for. The part with for command doesn't work. Here is the code:
I entered 2 as the input b and the result is that:Code:#include <stdio.h> int main() { int a,b,c,x; printf("Enter a number:\n"); a=2; scanf("%d",&b); if (b < 2) { c=a*b; } else if (b==2) { c=a*a+b*b; } else { c=a+b; } printf("%d\n",c); for (x=0;x<5;x++) { printf("%d\n", &x); } getchar(); return 0; }
8
2293520
2293520
...