Expand|Select|Wrap|Line Numbers
- #include<stdio.h>
- int main()
- {
- int num1,num2;
- printf("enter the value of num1 and num2:");
- scanf("%d %d",&num1,&num2);
- printf("num1 = %d and num = %d",num1,num2);
- return 0;
- }
I know that when scanf() reads any character which is not in the catagory of conversion specification it put back that character and end processing other inputs.But in the first case -(minus sign) seems to be irrelevent input according to the conversion specification but it shows correct output but in the later case it not showing correct output.Why?