This C Program using iteration, finds the product of 2 numbers without using the multiplication operator.
Here is the source code of the C program to display a linked list in reverse. The C program is successfully compiled and run on a Linux system. The program output is also shown below.
* C Program to find Product of 2 Numbers without using Recursion
int product(int, int);
int a, b, result;
printf("Enter two numbers to find their product: ");
scanf("%d%d", &a, &b);
result = product(a, b);
printf("Product of %d and %d is %d\n", a, b, result);
int product(int a, int b)
int temp = 0;
while (b != 0)
temp += a;
$ cc pgm19.c $ a.out Enter two numbers to find their product: 89 458 Product of 89 and 458 is 40762
Sanfoundry Global Education & Learning Series – 1000 C Programs.
If you wish to look at other example programs on Simple C Programs, go to Simple C Programs. If you wish to look at programming examples on all topics, go to C Programming Examples.