No, I was asking Robert_Ingleby, but he's already answered in a previous post
This works
Code:
#include <stdio.h>
int main(void) {
unsigned long int a,b,c,d;
printf( "Enter 1st number over 1000?" );
scanf( "%lu",&a );
printf( "Enter 2nd number over 1000?" );
scanf( "%lu",&b );
printf( "Enter 3rd number over 1000?" );
scanf( "%lu",&c );
d = (a*b*c);
printf( "The product of the 3 numbers is %lu\n",d );
return 0;
}
But only because the values are unsigned, and the result just fits. If the numbers get much bigger, even unsigned ints will be too small.
> The user inputs 3 numbers which when multiplied together then by 512 then divided by 1000000
Perhaps you could rearrange the multiplies and divides.
d = a * b * c ;
d /= 1000; // one part of the divide by 1000000
d *= 512;
d /= 1000; // the other part of the divide by 1000000
The key is knowing how many trailing 0 bits there are in the a*b*c product, because this will tell you the maximum size of the first division without causing any loss of information.