Hi People
I am trying to run the following program in at the command line in Ubuntu and it prompts for the first number ok but as soon as I press enter to input the next number it runs the program with an erroneous results.
Code:
#include <stdio.h>
int main()
{
int num1, num2;
int product;
printf("Please enter the first integer number: ");
scanf("%D%*c", &num1);
printf("Please enter the second integer number: ");
scanf("%D%*c", &num2);
product = num1 * num2;
printf("The product of the two numbers is: %d\n", product);
return(0);
}
Please enter the first integer number: 1
Please enter the second integer number: The product of the two numbers is: 0
the same program works perfectly well in a terminal in windows but not in Linux where I would prefer to be working.
Can anybody tell me why this is happening