Expand|Select|Wrap|Line Numbers
- #include<stdio.h>
- int main()
- {
- int age;
- char sex,ms;
- printf("enter age=");
- scanf("%d",&age);
- printf("enter sex=");
- scanf("%c",&sex);
- printf("enter marital status=");
- scanf("%c",&ms);
- getch();
- return 0;
- }
Sir,
I am Kanchan Undre,from Belgaum(karnataka state),I have typed the above program in
visual studio 2008 express edition and also in Turbo c,when i execute the said program
the first printf() fuction outputs the message "enter age=" and after supplying the value to
it the second and third printf() functions output the message together as
"enter sex=enter marital status="instead of second printf() function ("enter sex=").
why does the second printf() combines with the third printf() output the message together?