Very short code tt never work...please help
The code looks like this (got this from dev++ C tutorial):
Code:
#include <stdio.h>
main ()
{
int num1, num2;
printf("\nEnter first number ");
scanf("%d",&num1);
printf("\nEnter second number ");
scanf("%d",&num2);
if (num2 ==0) printf("\n\nCannot devide by zero\n\n");
else printf("\n\nAnswer is %d\n\n",num1/num2);
}
The problem is after the prog prompt me for the second no, and after I enter and hit the 'Enter' key, the whole program disappears - failing to print either the statements, "Cannot devide by zero" or "Answer is...".
Tried different compiler like Borland and also replacing scanf with getchar - and still get the same thing. Wat is wrong???
Thanks a zillion for your help.