hi guyz
i hv problem with my codes of the following question:
Write a C program to receive a series of integers from the operator. Calculates the product of those integers and print the total to the screen when negative value is enter.
the output hsould be like below:
Please enter an integer: 2
Please enter an integer: 5
Please enter an integer: 4
Please enter an integer: -1
Total (product):40
i hope u can help me out with this question
thank you,
Quote:
#include<stdio.h>
int main()
{
int num;
int sum;
int loop;
printf("Enter numbers:\n");
while (loop)
{
scanf("%d", &num);
sum = num * num;
if (num < 0)
printf("total: %d", sum);
}
getch();
}