Posted on 2007-10-11
Hi, I have made a simple C program which asks for two input numbers, divides them and then outputs the result. The two input numbers must be integers and the output must be as a float.
The program does not give the required output, e.g:
If, I enter in two numbers, 2 and 3 the program should divide those numbers and output the result which should be 0.66666666... instead it outputs 0.0000000
Here is the source code shown below:
printf("Enter two integers > ");
result = num1/num2;
printf("%d divided by %d is %f",num1,num2,result);