some statements are not executing in c progra

May 21, 2011 at 03:02:24
Specs: Windows 2000
I executed this program in turbo c IDE on windows 2000 environment
void main()
int a,b;
printf("enter the details"); //hi friends i understand this is a simple program but at some times
scanf("%d %d",&a,&b); //this program not executing after scanf statement ,it is not executing
if(a>b) //if condition at all plz help me to rectify this probs.
printf("a is greater\n");
printf("b is greate");

See More: some statements are not executing in c progra

Report •

May 21, 2011 at 12:24:43
The program worked for me under the same conditions - TC running under 2K; are you sure it isn't executing or maybe the window is closing before you can view the result?

what you might try is adding something like while(getchar() != 'q'){} after your printf statement to see if it's the window closing.

a == b will take the else path too, so you might want to retest or reword your else result.


Report •

June 2, 2011 at 08:20:25
y should do this
c = a-b ;
if ( c>0)
printf ( " a is greater \n");
printf (" b .................... \n);

Report •

Related Solutions

Ask Question