Why my program is giving garbage value in O/P after providing sufficient inputs?
I have given I/P as 10 & 40
& choose multiplication option as 3
.
My code is as follows:
int main()
{
int a,b,c,x;
printf("Enter a & b \n"); //printing
scanf("%d %d, &a,&b");
printf("1. add \n 2. sub \n 3. multiply \n 4. div \n 5. mod \n 6. and \n 7. or\n 8. not \n 9. xor \n");
printf("Enter your choice \n");
scanf("%d, &x");
switch(x)
{
case 1: c=a+b;
break;
case 2: c=a-b;
break;
case 3: c=a*b;
break;
case 4: c=a/b;
break;
case 5: c=a%b;
break;
case 6: c=a && b;
break;
case 7: c=a || b;
break;
case 8: c=~a;
break;
case 9: c=a^b;
break;
default: printf("Make correct choice\n");
}
printf("result is: %d",c);
return 0;
}