Newbie calculating problem
Hey,
I am very new to this and am trying to allow a user to enter 10 entries and have it calculate what the total is....
The code I have so far is...
Code:
/* Product calculating */
#include <stdio.h>
#include <stdlib.h>
void main()
{
int loop = 1, product;
do
{
printf("Please enter the price for product number %d: ", loop);
++loop;
scanf("%d",&product);
printf("The amount of the product you just entered was %d\n",product);
}while (loop <=10);
}
At the moment is does...
Please enter the price for product number 1: 123
The amount of the product you just entered was 123
and so on...
I would like it to say
Please enter the price for product number 1: 123
The amount of the product you just entered was 123
The total you have entered so far is 123
I would like to know what I need to put in the loop to have a total line. I have tried lots of combinations of &total = &total + product and things like that but am having no luck.
Thankyou for any help.
Andy